String encoding problems

Stephan Rose kermos at somrek.net
Mon Dec 3 11:40:56 PST 2007


On Mon, 2007-12-03 at 08:14 -0800, John Ralls wrote:
> 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).

Yup, definitely learned that one. =)

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

Thanks for the info, appreciate it. I actually started implementing my
own unicode aware string class and the work I've done already so far in
the past hour has already helped me understand a lot. 

Thanks,

Stephan


> 
> 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
> >
> 
> 
> ---------------------------------------------------------------------
> 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