With Qt 5.12 on Win32, encoding set to default (ISO 8859-1), searching for 'µ' also matches '?'.
'µ' (Micro Sign) case folds to 'μ' (Greek Small Letter Mu). QTextCodec::codecForName("ISO 8859-1") converts Greek Small Letter Mu to '?' indicating a failure but this is treated as valid. Therefore search text and document text 'µ' (Micro Sign) is tested as '?' and so matches '?'.
The solution is to check QTextCodec::canEncode before performing the fromUnicode as in this patch:
diff -r 82b2210d3a1c qt/ScintillaEditBase/ScintillaQt.cpp
--- a/qt/ScintillaEditBase/ScintillaQt.cpp Fri Apr 10 08:16:50 2020 +1000
+++ b/qt/ScintillaEditBase/ScintillaQt.cpp Fri Apr 10 09:27:43 2020 +1000
@@ -575,9 +575,11 @@
sCharacter[0] = i;
QString su = codec->toUnicode(sCharacter, 1);
QString suFolded = su.toCaseFolded();
- QByteArray bytesFolded = codec->fromUnicode(suFolded);
- if (bytesFolded.length() == 1) {
- pcf->SetTranslation(sCharacter[0], bytesFolded[0]);
+ if (codec->canEncode(suFolded)) {
+ QByteArray bytesFolded = codec->fromUnicode(suFolded);
+ if (bytesFolded.length() == 1) {
+ pcf->SetTranslation(sCharacter[0], bytesFolded[0]);
+ }
}
}
return pcf;
Fix committed as [b28166].
Related
Commit: [b28166]
Fix committed as [b28166].
Related
Commit: [b28166]