Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 3
    2. An std::string can hold a NULL character just fine. It can also hold utf-8 and wide characters as well. Commented Dec 31, 2008 at 4:29
  • @Juan : That put me into confusion again. If std::string can keep unicode characters, what is special with std::wstring? Commented Dec 31, 2008 at 4:33
  • 1
    @Appu: std::string can hold UTF-8 unicode characters. There are a number of unicode standards targeted at different character widths. UTf8 is 8 bits wide. There's also UTF-16 and UTF-32 at 16 and 32 bits wide respectively Commented Dec 31, 2008 at 4:40
  • With a std::wstring. Each unicode character can be one wchar_t when using the fixed length encodings. For example, if you choose to use the joel on software approach as Greg links to. Then the length of the wstring is exactly number of unicode characters in the string. But it takes up more space Commented Dec 31, 2008 at 4:43
  • I didn't say it could not hold a 0 '\0', and what I meant by doesn't play well is that some methods may not give you an expected result containing all the data of the wstring. So harsh on the down votes. Commented Dec 31, 2008 at 4:53