V
vsgdp
Hi,
Is there a unicode equivalent to std::string?
Is there a unicode equivalent to std::string?
vsgdp said:Hi,
Is there a unicode equivalent to std::string?
red said:std::wstring?
hence the question mark.Panjandrum said:for UTF-16, not for UTF-8.
Panjandrum said:for UTF-16, not for UTF-8.
Rolf said:So you say unicode is only UTF-8? And std::string is always UTF-16?
Panjandrum said:std::wstring and std::string are both not appropriate for
variable-length character encodings like UTF-8.
std::wstring and std::string are both not appropriate for
variable-length character encodings like UTF-8.
Old said:std::string is appropriate for UTF-8.
But you must remember that functions like size() and find() will
apply to the encoded bytes, not to the decoded version.
If that was your issue, then you could also say that std::wstring
is not appropriate for any Unicode encoding, because of combining
characters (ie. the string length won't match the number of
display characters).
Of course the correct answer is that you should engage your
brain when manipulating Unicode strings, and be aware of
these issues. Many applications do indeed use std::string for
UTF-8 processing.
You mean std::string is appropriate, "just" most member functions don't
work?
You use normalized UTF-16.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.