multibyte character string question

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have a variable of type wstring. Sometimes I end up with strange characters (user entered, non-english) and I am having trouble with them. Ill have a string like this
<pre class="prettyprint wstring myName; //Will be set to something like "John Doe";[/code]
except some of the characters will appear as weird symbols when viewed in the debugger. For example, one symbol that the VS2008 shows at position [1] in the string is a black diamond with a white question mark in it.

The debugger tells me the value of this character is 65533, some others are 65404, etc.
In testing the code, this was causing an out-of-bounds memory dereference, which crashed the program. myName was being passed as a parameter to a function, and when the call occurred, the program crashed. So I replaced the variable myName with
the actual data, in double quotes, wanting to see if the issue was with the variable. When I use these symbols inside of double-quotes as a parameter, the VS2008 compiler tells me "unexpected end of file"! Why?

View the full article
 
Back
Top