From: Declan McMullen on 8 Apr 2008 09:44 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(a)computing.dcu.ie School of Computing Postgrad Bay A
From: Alec Ross on 8 Apr 2008 10:31 Hi, std::string is simply a typedef for a specialisation of the class template std::basic_string, instantiated for the char type. Similarly wstring is the same template class instantiated for wchar_t. The wide char type would, I guess help with some aspects of unicode - but it is not designed to support unicode as such. HTH Alec In message <mailman.27.1207662690.19501.wx-users(a)lists.wxwidgets.org>, Declan McMullen <declan.mcmullen(a)gmail.com> writes >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. -- Alec Ross
From: John Ralls on 8 Apr 2008 12:02 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 platform). 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 between 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 interoperable 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(a)computing.dcu.ie > School of Computing > Postgrad Bay A _______________________________________________ > wx-users mailing list > wx-users(a)lists.wxwidgets.org > http://lists.wxwidgets.org/mailman/listinfo/wx-users
From: Declan McMullen on 8 Apr 2008 12:31 Cheers guys. On Tue, Apr 8, 2008 at 5:02 PM, John Ralls <jralls(a)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 platform). > 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 between > 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 interoperable 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(a)computing.dcu.ie > School of Computing > Postgrad Bay A _______________________________________________ > wx-users mailing list > wx-users(a)lists.wxwidgets.org > http://lists.wxwidgets.org/mailman/listinfo/wx-users > > > > _______________________________________________ > wx-users mailing list > wx-users(a)lists.wxwidgets.org > http://lists.wxwidgets.org/mailman/listinfo/wx-users > > -- http://www.computing.dcu.ie/~dmcmullen declan.mcmullen(a)computing.dcu.ie School of Computing Postgrad Bay A
From: Declan McMullen on 8 Apr 2008 13:20 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(a)gmail.com> wrote: > Cheers guys. > > > On Tue, Apr 8, 2008 at 5:02 PM, John Ralls <jralls(a)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 platform). > > 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 between > > 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 interoperable > > 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(a)computing.dcu.ie > > School of Computing > > Postgrad Bay A _______________________________________________ > > wx-users mailing list > > wx-users(a)lists.wxwidgets.org > > http://lists.wxwidgets.org/mailman/listinfo/wx-users > > > > > > > > _______________________________________________ > > wx-users mailing list > > wx-users(a)lists.wxwidgets.org > > http://lists.wxwidgets.org/mailman/listinfo/wx-users > > > > > > > -- > http://www.computing.dcu.ie/~dmcmullen > declan.mcmullen(a)computing.dcu.ie > School of Computing > Postgrad Bay A > -- http://www.computing.dcu.ie/~dmcmullen declan.mcmullen(a)computing.dcu.ie School of Computing Postgrad Bay A
|
Next
|
Last
Pages: 1 2 3 Prev: Re[2]: wxWidgets right choice for multi-platform? Next: Failed to build wxGTK on Ubuntu 7.10 |