CelestiaProject / Celestia

Real-time 3D visualization of space.
https://celestiaproject.space
GNU General Public License v2.0
1.81k stars 304 forks source link

Universe::findPath doesn't work with localized names #1736

Open 375gnu opened 1 year ago

375gnu commented 1 year ago

Describe the bug Universe::findPath doesn't work with localized names even when i18n parameter is true.

To Reproduce Steps to reproduce the behavior:

  1. Open search console.
  2. Type sol/зямля or any other full object name in your language.
  3. 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):

ajtribick commented 1 year ago

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

375gnu commented 1 year ago

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.