Re: [linux-audio-dev] [completely OT] c++ and UTF-8 question

From: Bob Ham <rah@email-addr-hidden>
Date: Wed Feb 21 2007 - 01:57:34 EET

On Mon, 2007-02-19 at 18:04 -0500, Paul Davis wrote:
> On Mon, 2007-02-19 at 19:49 -0300, Camilo Polyméris wrote:
> > Julien Claassen wrote:
> > > Hi!
> > > I'm sorry to ask that here, but it seems I can't get an anser anywhere else.
> > > Does the libstdc++ support UTF-8 strings? Or is there some simple example
> > > code snippet somewhere to derive/modify something which would fullfill this
> > > need?
> > > Kindest regards and thanks!
> > > Julien
> > >
> > > --------
> > >
> > Not really, but it is easy to implement:
> > typedef basic_string<wchar_t> string;
> > For UTF-16 (which is variable width) you'd have to supply your own
> > char_traits, or reimplement some string functions.
>
> Glib::ustring is probably what you want. Glib is not part of any
> graphics toolkit - it is a low level portability library providing lots
> of cross-platform and utility goodness.

It's worth noting that Glib::ustring stores strings as UTF-8 in memory,
as multi-byte strings (char *). The C++ library supports wide-character
strings (wchar_t *) but doesn't support conversion from multi-byte to
wide-character. The C library does (see code from previous post.)

Bob

-- 
Bob Ham <rah@email-addr-hidden>

Received on Wed Feb 21 04:15:03 2007

This archive was generated by hypermail 2.1.8 : Wed Feb 21 2007 - 04:15:04 EET