Celestia icon indicating copy to clipboard operation
Celestia copied to clipboard

Universe::findPath doesn't work with localized names

Open 375gnu opened this issue 1 year ago • 2 comments

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):

  • OS: all
  • Frontend: all
  • Version: 1.6, 1.7.0

375gnu avatar Jun 25 '23 09:06 375gnu

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

ajtribick avatar Jun 28 '23 15:06 ajtribick

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.

375gnu avatar Jun 28 '23 19:06 375gnu