From aef136e65281eca679ddd8b0e618fbc9115471d9 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 7 Sep 2016 14:19:33 +1200 Subject: [PATCH] Fix highlight of non-ASCII diagnostic type When the translation of "error" or "warning" contained non-ASCII characters, the code to highlight it in red or orange failed to work. The fix for this only works with a Unicode build of wxWidgets, but as of wxWidgets 3.0, all builds are Unicode, so this shouldn't be much of a problem as wxWidgets 2.x is close to obsolete now. Reported by Mateusz Golicz. --- src/cavernlog.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cavernlog.cc b/src/cavernlog.cc index c675fc37..327fd647 100644 --- a/src/cavernlog.cc +++ b/src/cavernlog.cc @@ -680,11 +680,20 @@ bad_utf8: cur += wxT(""); continue; default: +#ifdef wxUSE_UNICODE + cur += wxChar(ch); +#else + // This approach means that highlighting of "error" or + // "warning" won't work in translations where they contain + // non-ASCII characters, but wxWidgets >= 3.0 in always + // Unicode, so this corner case is already very uncommon, + // and will become irrelevant with time. if (ch >= 128) { cur += wxString::Format(wxT("&#%u;"), ch); } else { cur += (char)ch; } +#endif } } -- 2.11.4.GIT