This is the mail archive of the
mailing list for the GDB project.
Re: printing wchar_t*
On Friday 14 April 2006 16:55, Eli Zaretskii wrote:
> > From: Vladimir Prus <firstname.lastname@example.org>
> > Date: Fri, 14 Apr 2006 12:46:57 +0400
> > Cc: email@example.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.
> > > A wchar_t string is just an array, and GDB already has a feature to
> > > produce N elements of an array. In CLI, you say "print *array@20" to
> > > print the first 20 elements of the named array.
> > I don't know how many elements there are, as wchar_t* is zero terminated,
> > so I'd like gdb to compute the length automatically.
> That's easy. Assuming that is done, is it all you need?
Yes, that would be sufficient for me.