[MPlayer-dev-eng] [PATCH] use system locale instead of C locale
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue May 19 17:14:28 CEST 2009
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.
> > 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.
Also I consider the whole idea nonsense, why should the URL be encoded
in the local encoding? That would mean it would be completely impossible
to play a Japanese URL on e.g. a US Windows version.
IMO unless someone has a better idea, the source charset should just be
set to UTF-8.
More information about the MPlayer-dev-eng
mailing list