This thread got mentioned in another thread, so I thought it best to reply here in the original topic to keep things tidy.
Quote:
Originally Posted by NonNonBa
Thank you. But at the end, GazL just improves the way they are written, not enlightening their logic he finds confusing too.
|
The logic of the above code snippet is essentially correct, however, it's unnecessarily complicated as in practice it'd be no different than just setting
G_FILENAME_ENCODING='@locale' regardless of locale used.
G_BROKEN_FILENAMES=1 is just an older and misleadingly named way of specifying
G_FILENAME_ENCODING=@locale. They do exactly the same thing.
One only really needs to set this when not using a utf-8 locale as the default behaviour is to run as if
G_FILENAME_ENCODING=UTF-8,@locale was specified, which in the case of utf-8 locales is essentially the same as above.
The reason why non-utf8 locales will want to set
G_FILENAME_ENCODING=@locale is that it's possible for some non-utf8 sequence to be interpreted as a valid utf8 sequence, so it's safest to prevent that.
P.S. this is really just revisiting some of the things I said in post #1, only I'm a little more confident in my understand of all this 4 years later.