From bdca91c629c752bb733490dbb317c590646c4120 Mon Sep 17 00:00:00 2001 From: imReker Date: Mon, 12 Nov 2018 17:18:28 +0800 Subject: [PATCH] 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 --- src/common/webviewarchivehandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/webviewarchivehandler.cpp b/src/common/webviewarchivehandler.cpp index 963c7fd210..509bacd3c2 100644 --- a/src/common/webviewarchivehandler.cpp +++ b/src/common/webviewarchivehandler.cpp @@ -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); }