nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] character sets and localization

2010-11-13 15:47:20
Earl Hood wrote:
On Sat, Nov 13, 2010 at 11:50 AM, Jon Steinhart <jon(_at_)fourwinds(_dot_)com> 
wrote:
Look at the $LANG environment variable, that's probably a good start on most
systems. The various LC_ environment variables if you want to do more
localization work.

That's the way it is on my Linux system but that doesn't make it standard.

 printf("%s\n", nl_langinfo(CODESET));

Yes. Note that we already use this in nmh -- see get_charset() in
sbr/check_charset.c, for instance. [I'm not sure if the documentation
got updated -- lots of it still just mentions MM_CHARSET, and I don't
know if that's because some code still only deals with MM_CHARSET and
doesn't honour locale, or if we just didn't change the docs.]

We also already use iconv() for some things if the system has it -- see
sbr/fmt_rfc2047.c.

Both these are in my opinion the Right Way to handle charsets (they are
both POSIX); the only question is how much effort you want to go to to
support fallback options for systems which don't implement them. At
the moment we have ifdeffery for both these; I don't know whether the
code paths for "not supported" get much testing...

-- PMM

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>