Character encoding problem with FString::Contains

the base encoding unforunately won’t work with the russian language.

FString text = "test";
FString s(TCHAR_TO_UTF8(*passedText));
s = s.ToLower();	

Breaks all non-latin characters .

As in the documentation you would need a converter from ANSI to ISO/IEC 8859-5 and back.

ToUpper() and ToLower() Non-Trivial in Unicode

UE4 currently only handles ANSI (ASCII | code page 1252 | | Western European).

The least worst method to do this for all languages seems to be mentioned here en.wikipedia.org/wiki/ISO/IEC_8859

  • ISO/IEC 8859-1 for English, French, German, Italian, Portuguese, and both Spanishes
  • ISO/IEC 8859-2 for Polish, Czech, and Hungarian
  • ISO/IEC 8859-5 for Russian

The mappings from ftp.unicode.org/Public/MAPPINGS/ISO8859/ contain the conversion rules for the above mentioned languages. ‘CAPITAL LETTER’ and ‘SMALL LETTER’ info would be cross referenced with the appropriate unicode character to get the desired result.

1 Like