Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix some commands-related character encoding issues

1) remove OEM/Unicode environment hack. I know it used to fix things but
now it just breaks them; not really sure if anything changed (like maybe cygwin
got smarter?) or that hack was fixing some things while breaking other,
and I just didn't spotted those things it used to fix. Anyway, removing
that fixes #FS426.
2) feed IE widget utf-8, not ucs-16. Firstly, bundles assume utf-8 in
their htmls so they set charset in meta tag accordingly. Secondly, we
feed _ASCII_ string (<html>) before anything else so ucs-16 stream simply
make no sense for IE.

Together these two fixes should fix FS#157, FS#418, FS#426, maybe
others?
  • Loading branch information...
commit 94395e1da9554220b6a015f36efeea934de18aae 1 parent 4bfa0e9
@tea tea authored
Showing with 4 additions and 28 deletions.
  1. +0 −22 src/Env.cpp
  2. +4 −6 src/IEHtmlWin.cpp
View
22 src/Env.cpp
@@ -105,29 +105,7 @@ void cxEnv::GetEnvBlock(wxString& env) const {
//wxLogDebug(wxT("%d: %s"), i, line);
-#ifdef __WXMSW__
- // Convert to utf8
- const wxCharBuffer buf = line.mb_str(wxConvUTF8);
-
- // to avoid unicode chars being mangled by windows automatic
- // conversion to oem, we first convert the utf8 text to unicode
- // as if it was oem. Windows will convert it back to oem, which
- // will then preserve the utf8 encoding.
- // We use native MultiByteToWideChar to ensure we get the right
- // codepage no matter the current locale.
- const size_t len = ::MultiByteToWideChar(CP_OEMCP, 0, buf.data(), -1, NULL, 0);
- if (len) {
- wxWCharBuffer wBuf(len);
- ::MultiByteToWideChar(CP_OEMCP, 0, buf.data(), -1, wBuf.data(), len);
- env += wBuf;
- }
- else wxASSERT(false);
-
- //const wxString oemEnv(buf, wxCSConv(wxFONTENCODING_CP437));
-
-#else
env += line;
-#endif
env += wxT('\0');
}
View
10 src/IEHtmlWin.cpp
@@ -252,14 +252,12 @@ class wxOwnedMemInputStream : public wxMemoryInputStream
bool wxIEHtmlWin::LoadString(const wxString& html, bool prependHtml)
{
+ const wxCharBuffer buf = html.utf8_str();
char *data = NULL;
- size_t len = html.length();
-#ifdef UNICODE
- len *= 2;
-#endif
+ size_t len = strlen(buf.data());
data = (char *) malloc(len);
- memcpy(data, html.c_str(), len);
- return LoadStream(new wxOwnedMemInputStream(data, len), prependHtml);
+ memcpy(data, buf, len);
+ return LoadStream(new wxOwnedMemInputStream(data, len), prependHtml);
};
bool wxIEHtmlWin::LoadStream(IStreamAdaptorBase *pstrm, bool prependHtml)
Please sign in to comment.
Something went wrong with that request. Please try again.