std::string and unicode

Declan McMullen declan.mcmullen at gmail.com
Tue Apr 8 10:20:50 PDT 2008


This guy actually wrote two nice little functions
http://www.kangmaman.com/node/131

On Tue, Apr 8, 2008 at 5:31 PM, Declan McMullen <declan.mcmullen at gmail.com>
wrote:

> Cheers guys.
>
>
> On Tue, Apr 8, 2008 at 5:02 PM, John Ralls <jralls at ceridwen.us> wrote:
>
> > Yes, it's correct that std::string doesn't support Unicode. Unicode
> > requires more than one byte per character (except for ASCII characters =
in
> > UTF8), so wxChar becomes either 16bit or 32bit (depending on the platfo=
rm).
> > You'll have to transcode everything that you need to pass between
> > std::string and wxString, and you'll have to wrap all of your literals =
in
> > wxT macro. See the topic overviews on Unicode support and Conversion be=
tween
> > Unicode and multibyte strings.
> > There's an alternative, but it requires that you switch to the
> > development branch. The Unicode support for 2.9/3.0 has been rewritten =
to
> > use UTF8, which uses 8-bit wxChar and is therefore somewhat interoperab=
le
> > with std::string if you're careful about it.
> >
> > Regards,
> > John Ralls
> >
> >
> >
> > On Apr 8, 2008, at 6:44 AM, Declan McMullen wrote:
> >
> > Hi Guys,
> > I'm slightly confused about something. Does std::string not support
> > unicode ?
> > I have stl enabled in my wxwidgets compilation. The reason I did it is
> > because
> > I have some backend classes that use std::string and I didnt want to be
> > converting to
> > and from std::string to wxString. Turning on stl meant my strings could
> > be interchangeable.
> >
> > However I want to work with locales so I went to use the unicode build
> > of wx widgets, this
> > however fails to allow me to have interchangeable strings.
> >
> > So if I want to use unicode will I have to use wxString and perform a
> > conversion?
> >
> > I've been looking through the internationalization section of the book
> > but i've ended up confused :)
> >
> > Any guidance much appreciated.
> >
> >
> >
> > --
> > http://www.computing.dcu.ie/~dmcmullen
> > declan.mcmullen at computing.dcu.ie
> > School of Computing
> > Postgrad Bay A _______________________________________________
> > wx-users mailing list
> > wx-users at lists.wxwidgets.org
> > http://lists.wxwidgets.org/mailman/listinfo/wx-users
> >
> >
> >
> > _______________________________________________
> > wx-users mailing list
> > wx-users at lists.wxwidgets.org
> > http://lists.wxwidgets.org/mailman/listinfo/wx-users
> >
> >
>
>
> --
> http://www.computing.dcu.ie/~dmcmullen
> declan.mcmullen at computing.dcu.ie
> School of Computing
> Postgrad Bay A
>



-- =

http://www.computing.dcu.ie/~dmcmullen
declan.mcmullen at computing.dcu.ie
School of Computing
Postgrad Bay A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20080408/1a6=
c715d/attachment.htm


More information about the wx-users mailing list