[MPlayer-dev-eng] [PATCH] use system locale instead of C locale

KO Myung-Hun komh at chollian.net
Wed May 20 15:51:02 CEST 2009


Hi/2.

Reimar Döffinger wrote:
> On Tue, May 19, 2009 at 11:20:02PM +0900, KO Myung-Hun wrote:
>   
>> I've fixed by allocating buffer for 'charset'. OS/2 implementation of 
>> nl_langinfo( CODESET ) returns the static variable. So even though if we 
>> got 'charset' by setting locale to system one, it is changed to new one 
>> after setting locale to C. But we should accept memory-leak. Fine ?
>>     
>
> The generic (in getch2.c) code needs the same change.
> Also the code for getch2-win.c should be changed to use malloced memory
> too, and get_term_charset get a documentation stating it will return
> a malloced string.
>
>   

Ok. I'll do that later.

>>> 2.  stream/asf_mmst_streaming.c uses nl_langinfo(CODESET) to select 
>>> 'from code' of iconv_open(). But if C locale is used, national 
>>> characters such as DBCS are not converted correctly to UTF-16LE.
>>>       
>> And I wrapped setlocale() around nl_langinfo()  to use system locale. 
>> This enables to use URL consisted of national characters.
>>     
>
> As I said, this can't be done because setlocale is not thread-safe.
>   

If so, how about introducting a new global variable for terminal charset 
such as mp_term_charset.

> Also I consider the whole idea nonsense, why should the URL be encoded
> in the local encoding? 

But, actually filenames consisted of national characters are being used. 
And in case of Internet Explorer, the option whether to use UTF-8 
encoding for filename or not is provided. In addition, I think the 
reason why nl_langinfo() is used, is to support such a thing.

> That would mean it would be completely impossible
> to play a Japanese URL on e.g. a US Windows version.
>   

This problem is also true for the current method.

> IMO unless someone has a better idea, the source charset should just be
> set to UTF-8.
>   

I think we'd better introduce a option whether to use UTF-8 or national 
characters for URL such as -usenlsurl as IE does.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 1.1.16
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 1 GHz with 512 MB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr





More information about the MPlayer-dev-eng mailing list