String encoding problems

John Ralls jralls at ceridwen.fremont.ca.us
Mon Dec 3 08:14:48 PST 2007


If your IO code depends on a particular sizeof(wchar_t) you'll have to  
rewrite it. As you've learned it's not portable to depend on that,  
just like you can't depend on sizeof(int).

Take a look at ICU (http://www.icu-project.org/), which unlike either  
wxString or std::wstring actually understands Unicode.

Regards,
John Ralls

On Dec 3, 2007, at 1:17 AM, Stephan Rose wrote:

> Hi all,
>
> how does everyone deal with string encodings? Here is a problem I'm
> running into.
>
> Currently I'm primarly using std::wstring in my project. Under linux,
> wchar_t is 32-bit. Wonderful as it means that any character will fit
> fully into one wchar_t.
>
> So then the other day, I check out windows and realize windows does
> 16-bit for wchar_t. Now the above no longer holds true, nor does my  
> file
> IO code like this as it expects wchar_t to be 32-bit.
>
> I suppose I can save / load via utf-8 but I still have the problem  
> after
> loading with my internal representation. Using wxString isn't really  
> an
> option in those areas as I'm trying to keep most of the affected code
> api independent.
>
> Any thoughts / suggestions appreciated!
>
> Thanks,
>
> Stephan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>





More information about the wx-users mailing list