[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: determining locale's character set



On Mon, 17 Jan 2000, Markus Kuhn wrote:

> For more portable applications and those who want to bypass setlocale()
> entirely, I would suggest as a simpler alternative something like
> 
>   if ((s = getenv("LC_ALL")) ||
>       (s = getenv("LC_CTYPE")) ||
>       (s = getenv("LANG"))) {
>     if (strstr(s, "UTF-8") || strstr(s, "utf-8")) {
>       /* let's do it in UTF-8 */
>       ...
>     }
>   }

This breaks when we move locales to be UTF-8 by default. (which will
hopefully happen at some point this decade). I'd suggest doing a
combiniation of langinfo and if that fails resorting to the above.

-- 
Robert

-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/