[MPlayer-dev-eng] locale in GUI

Ivan Kalvachev ikalvachev at gmail.com
Fri Apr 5 04:08:55 CEST 2013


On 3/10/13, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> On 10 Mar 2013, at 21:08, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
>> 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.
>
> And there is also the uselocale etc. stuff from xlocale.h, but I'm nit
> exactly a fan of it for several reasons.

I asked Dalias about it, after all he maintains feature complete libc
library (musl).

<dalias> the problem was solved a long time ago by glibc and
incorporated into POSIX.1-2008
<dalias> it's called uselocale()
<dalias> it sets a thread-local locale
...
<dalias> locale.h is its official header
<dalias> xlocale.h is from back when it was a nonstandard draft

I guess we may still need configure check to use it.

Anyway, I assume the problem is already solved?


More information about the MPlayer-dev-eng mailing list