home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,784 of 33,346   
   cpp4ever to Fulvio Esposito   
   Re: unicode and string   
   06 Jan 12 17:25:04   
   
   0b2b37c3   
   From: n2xssvv.g02gfr12930@ntlworld.com   
      
   On 05/01/12 17:05, Fulvio Esposito wrote:   
   > Hi all,   
   > I was recently studying unicode and internationalization and   
   > some questions come to my mind about C++ string.   
   >   
   > Correct me if I'm wrong. std::string and std::wstring member   
   > functions simply doesn't work for UTF-8 or UTF-16 encoded   
   > strings 'cause they wrongly assume "code_point==code_unit"   
   > (for example length() returns the length of the sequence   
   > and not the size of the unicode string, operator[] could   
   > not return the code point if it's represented by two or   
   > more code unit, etc.).   
   >   
   > So in the end, what's the best strategy to handle unicode   
   > strings in C++? Many suggest to use UTF-8 and std::string,   
   > many others UTF-16 and std::wstring (but on linux wchar_t   
   > are often 32-bit wide :S), ICU uses UTF-16 by default but   
   > has its own UnicodeString.   
   >   
   > As a use case, imagine a GUI Toolkit, what should be the   
   > type of the Text property for a TextBox?   
   >   
   > Fulvio Esposito   
   >   
   >   
      
   Hmmmm, not something I'd like to try to do, but then I use Qt GUI   
   toolkit which already provides unicode string handling for QString. Rest   
   assured your concerns are well justified, having experienced problems   
   with Japanese characters when unicode was not maintained for all strings.   
      
   regards   
      
   cpp4ever   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca