[MPlayer-dev-eng] locale in GUI

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Mar 10 21:08:23 CET 2013


On 10 Mar 2013, at 20:50, Hans-Dieter Kosch <hdkosch at kabelbw.de> wrote:
> Reimar Döffinger wrote:
>> On 10 Mar 2013, at 20:24, Hans-Dieter Kosch <hdkosch at kabelbw.de> wrote:
>>> 
>>> old_locale = setlocale(LC_ALL, NULL);
>>> setlocale(LC_ALL, "");
>>> g_filename_to_utf8(...);
>>> setlocale(LC_ALL, old_locale);
>>> 
>>> Bad hack, admittedly.
>> No, broken. setlocale affects all threads. It might result in for example HTTP requests made by the cache (if run in thread instead of separate process) randomly generating wrong requests.
>> A debugging nightmare.
> 
> Yes, I know about this thread awareness, so what can we do? Some kind of locking (I had bad experience with such things in the past)?

Locking around what? Around every C library call?
Anyway you should probably figure out which locales you are actually using.
Either way my basic opinion is the same as back then: using anything other than UTF-8 for file names is stupid on a level that honestly not even trying to support it would be best by far.
The second best alternative is to provide a fixed fallback if the name is not valid UTF-8.


More information about the MPlayer-dev-eng mailing list