[MPlayer-dev-eng] [PATCH] Use _NET_WM_NAME for UTF-8 title in X11 if supported

Rich Felker dalias at aerifal.cx
Wed Jun 21 07:53:57 CEST 2006


On Wed, Jun 21, 2006 at 09:32:11AM +0400, Sergey Pinaev wrote:
> On Tue, 20 Jun 2006 21:11:40 +0200
> Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
> 
> > >  // Window    mRootWin;
> > >      XWindowAttributes attribs;
> > >      char *dispName;
> > > +
> > > +    setlocale(LC_CTYPE, "");
> > 
> > setlocale is forbidden (with the mp_msg.c exception).
> 
> Even for LC_CTYPE? Why? It's affects only things like isalpha(),
> islower(), tolower/toupper.

toupper/tolower is not the worst problem, but still bad. Calling
setlocale causes them to be broken in the Turkish locale. This is
known to prevent certain code from working due to i/I mapping to
non-ASCII characters. It actually caused MPlayer to crash in the past,
IIRC.

Blame C for stupidly linking the concept of codeset to language and
case rules...

The worst problem, for anyone interested, is LC_NUMERIC. Replacing .
with , causes all sorts of nightmares for parsing and writing data
files. Aside from tutorial programs in textbooks, the printf and scanf
family of functions are used mostly for reading and writing data files
which must have the same format regardless of locale. This is
certainly a more important use than printing messages to the user or
receiving input from the user in the user's own cultural conventions.

Stupid design mistakes like this in locale are what makes it obvious
that _localization_ is about exactly what it sounds like: making
data "localized" so that it only works in the place it was created and
so that it's not interoperable...

</flame>

Rich


P.S. It would have been incredibly easy for C to add a flag to the
printf format specifiers to indicate whether to use a localized format
or the "C locale" format when printing numbers, but instead they chose
the incredibly broken and stupid way, making locale essentially
useless in practice...

OK now I'll really stop flaming..




More information about the MPlayer-dev-eng mailing list