The information in this article applies to:
SYMPTOMSWhen trying to watch a Unicode string in the Watch window, you see only the first byte, or it is displayed incorrectly. CAUSEMaking the debugger "Unicode aware" at the display level involves the complicated task of setting and using locales and fonts properly. This is especially difficult if they are not the ones currently in use. This functionality has not yet been implemented. RESOLUTIONYou can use the 'm' format symbol to see the first eight characters of a string, or you could use the 'ma' format symbol to see the first 32 characters. For example, if you have a declaration in your code like this:
Adding the expression pStr,m to the Watch
window results in a memory dump of the first 16 bytes, immediately followed
by the ASCII equivalent, similar to this:
The periods are place holders for null bytes, which show up behind their
corresponding characters because wchar_t's are defined as two-byte unsigned
shorts, whose bytes are thus reversed in memory. (This is why only the
first character 'S' would be displayed by default in the example above. The
debugger sees the null byte following the 'S' and assumes it is the string
terminator.)
This method will obviously work only with short strings. As an alternative, you can open up the memory window and point it to the starting address of your string. Note that dragging or dropping the string's address from the Watch window to the Memory window makes this much easier. MORE INFORMATIONFor future versions, Microsoft is considering ways to allow watching Unicode strings directly using the current locale. Additional query words:
Keywords : kbdisplay kbDebug kbide |
Last Reviewed: January 31, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |