On Tue, Jan 03, 2006 at 03:13:52PM +0200, Pasha Zubkov wrote:
> >Where is that quoted from?
> 
> http://docs.hp.com/en/B9106-90012/orientation.5.html
> This is for HP-UX, but it's true for glibc to.

Ah.  Between this and your glibc link below, I'll agree with you --
fgetwc or getwc on a popen()ed stream won't work right.

But I wonder if you can freopen() a popen()ed stream?  If so, you could
first freopen() it, then fwide() the new stream; then you'd get
automatic handling of any locale.

> >But if there is a difference, then the iconv sample on that page (see
> >6.5) could be a better choice than hardcoding the UTF-8 conversion, and
> >(therefore) only working in a UTF-8 charset environment.
> 
> Sorry for that, i'm not a C programmer :)

:-)

> >(Plus, you
> >don't know what the user will set LC_CTYPE to; it might be utf8, it
> >might be utf-8, it might be UTF8, and any of these will break the
> >patch.)
> Standard recomends using UTF-8.

Yes, but we've had some issues before when people don't -- I believe it
was with some X programs.  They hardcoded either LC_MESSAGES or LC_CTYPE
values, and subsequently broke when someone used a different string than
what they were expecting.  Or something like that.

Hardcoding the value for LC_CTYPE or LC_MESSAGES is *never* a good idea.
Just let iconv() handle LC_CTYPE for you, and let gettext() handle
LC_MESSAGES.

(Yes, you have to use nl_langinfo() to get a string to pass to iconv_open
-- but I believe anything that nl_langinfo returns is supposed to be
valid for iconv_open.)

Attachment: pgpnreA7cyCSn.pgp
Description: PGP signature

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to