This is the mail archive of the
mailing list for the GDB project.
Re: printing wchar_t*
> 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?
Anyway, UTF-16 is a variable-length encoding, so wchar_t is not it.
> > For example, in command-line version of GDB, if the terminal supports
> > UTF-8 encoded characters, that function would output a UTF-8 encoding
> > of the non-ASCII string, and then the terminal will display them with
> > the correct glyphs.
> This is non-starter. I can't have debuggee send data to KDevelop widgets.
That was just an example. I know it's irrelevant to your case (and,
in fact, to any GUI front-end).
> > 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?