🔒 Locked
Unicode String
Advertisement
Original Post
You may want to try using std::wstring, which is like std::string, except that it uses wchar_ts intead of chars. However, the standard doesn't guarantee that std::wstring will use a unicode encoding. Typical C++ library implementations use UCS-2 encodings which can be considered a Unicode subset.
Firstly, anyone who declares typedefs like that and gets away with it needs their compiler looking at...
Secondly, the standard is a little sketchy about what wchar_t actually is:
This has the unfortunate consequence of meaning your wide string use 2 bytes per character on Windows and 4 bytes per character on most *nix (including Mac OSX) systems.
typedef ustring std::basic_string<int32>; should have the order of names reversed.Secondly, the standard is a little sketchy about what wchar_t actually is:
Quote:
values can represent distince codes for all memebers of the largest extended character set specified among supported locales.
This has the unfortunate consequence of meaning your wide string use 2 bytes per character on Windows and 4 bytes per character on most *nix (including Mac OSX) systems.
Quote:
Original post by Code-R
std::basic_string is a template. you can support the latest 31bit unicode by doing:typedef ustring std::basic_string<int32>;
:D:D
That typedef does not guarantee a unicode encoding. Furthermore, typedefs for basic_string other than std::string or std::wstring are inherently difficult to use since you then have to define nearly all the functions necessary to use them. Ex: specialize std::ctype
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement