I have some server-side C# code that serializes (among other things) some Unicode strings (using UTF8 encoding).
On the client side, I would like to deserialize all these strings. I was able to deserialize them and store them as wstring
s.
But then I've heard that Unicode strings can be stored in regular string
s as well. I've also read that wstring
s are not portable and should therefore be avoided. So I am wondering what are the benefits/drawbacks of using string
vs. wstring
in my situation.
Also, I still don't understand how is it possible to store Unicode strings inside of regular string
variables. That sounds strange knowing that string is vector of chars. How can an arbitrary character be stored inside of a char (8-bit type)? Would string::length()
return the number of characters or bytes? What about string::size()?
What would the indexing operator return?