[MPlayer-dev-eng] [PATCH] implement the setlocale feature

Rich Felker dalias at aerifal.cx
Mon Jun 19 19:23:13 CEST 2006


On Mon, Jun 19, 2006 at 11:36:39AM +0200, Reimar Döffinger wrote:
> Hi,
> On Mon, Jun 19, 2006 at 12:55:36PM +0800, Fengguang Wu wrote:
> > Attached a patch using UTF-8 unconditionally, comments are welcome.
> 
> Much better, but still the original code is really broken.
> 1) There are already utf8->utf16 conversion functions in MPlayer, like
> libvo/sub.c, utf8_get_char so iconv is not needed.

No, there are utf8->utf32 conversion functions. What's needed here is
utf16->utf8.

> 2) Stuff like strlen(path)*2 to get the length of UTF-16 string will only
> work for pure ascii as well...

No, it will not work for anything containing ascii or latin1
characters. Pure ascii in utf-16 looks like:

"H\0e\0l\0l\0o\0,\0 \0w\0o\0r\0l\0d\0!\0"

This is why utf-16 is utter crap and should never be used.

Rich




More information about the MPlayer-dev-eng mailing list