Fix i18n URL parsing problem in wxWebViewArchiveHandler

URL is encoded as UTF-8, so using c_str() may generate invalid encoded
representation in non-UTF-8 locales.

Closes https://github.com/wxWidgets/wxWidgets/pull/1022
This commit is contained in:
imReker
2018-11-12 17:18:28 +08:00
committed by Vadim Zeitlin
parent c913f4a3df
commit bdca91c629

View File

@@ -85,7 +85,7 @@ wxFSFile* wxWebViewArchiveHandler::GetFile(const wxString &uri)
return NULL;
wxString fspath = "file:" +
EscapeFileNameCharsInURL(path.substr(doubleslash + 2).c_str());
EscapeFileNameCharsInURL(path.substr(doubleslash + 2).utf8_str());
return m_fileSystem->OpenFile(fspath);
}
//Otherwise we need to extract the protocol
@@ -108,7 +108,7 @@ wxFSFile* wxWebViewArchiveHandler::GetFile(const wxString &uri)
return NULL;
wxString fspath = "file:" +
EscapeFileNameCharsInURL(mainpath.substr(doubleslash + 2).c_str())
EscapeFileNameCharsInURL(mainpath.substr(doubleslash + 2).utf8_str())
+ "#" + protocol +":" + archivepath;
return m_fileSystem->OpenFile(fspath);
}