[MPlayer-dev-eng] Re: [PATCH] print appropriate error when failing to open a file

Rich Felker dalias at aerifal.cx
Wed Dec 14 17:32:41 CET 2005


On Wed, Dec 14, 2005 at 03:52:38PM +0100, Tobias Diedrich wrote:
> Rich Felker wrote:
> 
> > > No need to switch to gettext for that, as soon as we do
> > > "setlocale(LC_MESSAGES, "");" strerror will return a localized
> > > message.
> > 
> > The problem is that setlocale is banned in MPlayer for good reason.
> > It's a completely broken approach to handling locale.
> 
> AFAIK the only issues MPlayer had with setlocale was because of
> LC_NUMERIC affecting scanf.

No, there's also the matter of case-insensitive comparisons and
Turkish I/i, among many other evil things that we haven't even found
yet.

> But since you can selectively only use LC_MESSAGES if you want to,
> I don't really see a problem there, banning setlocale completely is
> a bit of an overreaction IMHO.
> 
> And at least the unix locale handling is much better than the
> windoze solution.

It's global to the whole program and affects the basic libc functions
which should behave in a known and predictable way. The only valid way
to implement locale would have been to keep the classic C functions
behaving in the C/POSIX locale way, and have a parallel set of
functions that use locale and take the locale id/context as an
argument to the function. Having locale be a global variable is also
not acceptable!

I don't know how Windows does it. You're probably right that it's more
broken. But the POSIX way is already broken beyond repair.

> At the moment MPlayer's locale handling is _very_ lacking, since you
> can't change character encoding or message language at runtime.

Using setlocale will not solve the character encoding problem, or the
message language problem.

Rich




More information about the MPlayer-dev-eng mailing list