Re: How to print the byte representation of a wchar_t string with non -ASCII ...

From: DougEwell2@cs.com
Date: Wed Oct 31 2001 - 18:22:18 EST


In a message dated 2001-10-31 10:07:44 Pacific Standard Time,
drepper@redhat.com writes:

> This is wrong. wchar_t strings can of course be printed. Reading the
> ISO C standard would tell you to use
>
> printf ("%ls", wstr);
>
> can be used to print wchar_t strings which are converted to a byte
> stream according to the currently selected locale. Eventually it has
> to be wprintf() if the stdout stream is wide oriented. Read the
> standard.

Oops, sorry. I hadn't read the standard, and so I didn't know that.
(Probably shouldn't have answered William's question in that case.)

But won't this approach fail as soon as we hit a 0x00 byte (i.e. the high 8
bits of any Latin-1 character)?

Also, Addison's response is correct that wchar_t is not going to be natively
UTF-8.

-Doug Ewell
 Fullerton, California



This archive was generated by hypermail 2.1.2 : Wed Oct 31 2001 - 19:22:11 EST