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

Rich Felker dalias at aerifal.cx
Thu Jun 22 04:50:26 CEST 2006


On Wed, Jun 21, 2006 at 10:34:40AM +0400, Sergey Pinaev wrote:
> On Wed, 21 Jun 2006 01:53:57 -0400
> Rich Felker <dalias at aerifal.cx> wrote:
> 
> > > > 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.
> 
> afaiu this is not "locale" problem, but just mistake of man, who
> write locale definition file for Turkish.
> (Keld.Simonsen at dkuug.dk according to /usr/share/i18n/locales/tr_TR)

The idea that case mappings are locale-specific and that they can vary
with locale is broken in itself. This is the fundamental problem and
sadly Unicode left it broken rather than making separate characters:
  UPPERCASE DOTLESS I
  UPPERCASE DOTTED I
  LOWERCASE DOTLESS I
  LOWERCASE DOTTED I
for Turkish.

Due to horrible broken issues like this, case conversion of
multilingual text is IMPOSSIBLE without tagging the language of each
segment of text.

> > 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...
> 
> char *saved = setlocale(LC_NUMERIC, "C");
> printf("%f\n", blah);
> setlocale(LC_NUMERIC, saved);

Not thread-safe. :) I hate threads but some (many) developers on other
projects want them.

> Yes, in this simple case this can look "bloat". But when code between
> setlocale's is more complex and have more %'s it is simpler/cleaner
> than "locale modifiers" appended to each %, imho.

Not at all. There's already a locale modifier for thousands-separators
in printf (even tho the locale specifies thousands-sep, they're not
printed by default because it was deemed too broken.. :). In any case,
a single byte in format strings is MUCH less bloat than 2 extra
function calls all over the place (and huge nasty app-wide mutex if
the program is using threads!).

Rich




More information about the MPlayer-dev-eng mailing list