This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH RFC] Character set support


Daniel Jacobowitz <drow@mvista.com> writes:
> I'm not suggesting reading wchar_t's from the target; that's not
> terribly useful a thing to do.  You _want_ the host wchar_t.  It is
> a host type capable of holding a wide character; the type changes
> based on platform and on whether or not the platform actually has
> wide character support.

If you're suggesting using the host's wchar_t to hold characters after
conversion from the target charset to the host charset, then I'm with
you.

If you're suggesting using the host's wchar_t to hold character values
that have been read from the target, but not yet converted to the
host's charset, then I really disagree.  The target's wchar_t could be
32 bits, while the host's might be 16 bits.

> There's not much you can do if it doesn't, is there?

Print things in hex?  When the target->host conversion fails, you
can't just drop the character, but you still need some way to
represent the pre-conversion value in GDB.

> Rather than using iconv, which is meant for converting strings of
> text, it seemed to me when I wrote the above comments that we should
> be using mbrtowc/wctomb functions.  However, unlike iconv, they
> appear to operate based on the current locale rather than a
> specified charset.  I suppose they are unsuitable and we'll have to
> figure out how to use iconv appropriately.

Yes, exactly.  If mbrtowc were parameterized with the charset, it
would work pretty well.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]