Re: printing wchar_t*

Robert Dewar
2006-04-14T13:06:37Z

Vladimir Prus wrote:
> On Friday 14 April 2006 16:55, Eli Zaretskii wrote:
>>> From: Vladimir Prus <ghost@cs.msu.su>
>>> Date: Fri, 14 Apr 2006 12:46:57 +0400
>>> Cc: gdb@sources.redhat.com
>>>
>>> No, I meant UTF-16 encoding (the one with surrogate pairs), and UTF-32
>>> encoding (which does exists, in the Unicode standard).
>> What software uses that?
>
> I'd say, any software using std::wstring on Linux.
>
>> Anyway, UTF-16 is a variable-length encoding, so wchar_t is not it.
>
> Since C++ standard says nothing about encoding of wchar_t, specific
> application can do anything it likes. In particular, I believe that on
> Windows, wchar_t* is assumed to be in UTF-16 encoding.

It only makes sense to talk about UTF-16 encoding in the context
of wchar_t if wchar_t is 16-bits, otherwise, as noted above, UTF-32
is a variable length encoding, not suitable for wchar_t.