Celestia
Celestia copied to clipboard
Universe::findPath doesn't work with localized names
Describe the bug
Universe::findPath
doesn't work with localized names even when i18n
parameter is true
.
To Reproduce Steps to reproduce the behavior:
- Open search console.
- Type
sol/зямля
or any other full object name in your language. - See that nothing is selected.
Expected behavior Object searched should be found, e.g. Earth in the example above.
Desktop (please complete the following information):
- OS: all
- Frontend: all
- Version: 1.6, 1.7.0
Search works fine for me when using German. I suspect the issue is that the case-insensitive searching is built on top of the standard library tolower
/towlower
functions, which may well be limited to the ASCII subset of characters. If so, the search would work if you capitalised the Cyrillic letters exactly the same as they are in the file.
Fix would then be to use either ICU casefolding or the string collation functions.
We should also try to eliminate the wchar
stuff as much as possible in favour of Unicode types like char16_t
https://en.cppreference.com/w/cpp/string/byte/tolower says that locale is taken into account:
Converts the given character to lowercase according to the character conversion rules defined by the currently installed C locale.
I'm stupid. Of course it doesn't work with multibyte encodings.