views:

674

answers:

3

For some time now when I am debugging Visual C++ applications and viewing any CString or char* (or any other ascii char based type) variable in the Local, Auto, or Watch debug windows, the CR/LF characters in my variables are not displayed at all.

In other words, if I have a string variable set to "This is a line\r\nThis is another line" in my code, the debug window will show "This is a lineThis is another line". What I would like it to show is "This is a line□□This is another line" so that I can see the two extra characters in that text.

This has caused me to make some mistakes when trying to debug string parsing code. Note, the text visualizer properly breaks the text up into separate lines, but I don't want to use the text visualizer if I don't have to. Furthermore, some coworkers of mine are able to see CR/LF characters in the correct manner, but we cannot determine why they are not shown for me.

Many thanks in advance.

A: 

Could it be the font you are using? are you all using the same (preferably default) font?

I've had a number of pesky issues come up with people doing that. Not sure if that is your problem, but its something to check.

cyberconte
For the "[Watch, Locals, and Autos Tool Windows]" setting in Tools->Options->Environment->Fonts and Colors, I am using the Tahoma font. I believe that is the default settings, and my coworkers are also using this font.
Derek
+3  A: 

This seems to be some sort of hard-to-reproduce bug (I'm not seeing them in 2k8 either) according to this old link:

If we wanted to do this properly we'd need to issue the proper escape sequences for these characters. eg show "\r\n" in the string. The behavior of stripping special characters historical and will be fixed in a future release. If you are viewing text with newlines in it you can either view the string as a character array: type "str,100" to view a string of length 100 as an array. Or you can click on the magnifying glass glyph and view the string in a multiline edit control.

A month later:

We cannot reproduce this problem on neither VS2003 nor VS2005. This looks like a machine-specific problem.

So if your coworkers are really seeing it then there must be something weird going on in our setups.

Steve M
Nice find. One other thought that occurred to me was my OS version. I'm the only one here running Vista x64 (both at work and at home, and both have the same problem) while everyone else is running 32 bit XP or Vista. That bug report looks like it was submitted by someone running XP, though.
Derek
This could be a 64-bit bug (even though VS itself is only 32). At home I run VS2k8 on Windows 7 x64 and don't see anything, but at work I've got VS2k5 on XP x32 and _do_ see the squares in place of \r\n.
Steve M
I use VS 2005 on XP 64 and don't see anything for \r or \n, so it's looking likely to be a 64-bit problem. Weird though - VS itself is 32-bit, and I'm only working with 32-bit code.
RichieHindle
A: 

Ok, I have the same kind of sort in relation of seeing these little squares instead of crlf on my program developed on VS2k8. But this is a SQL Server problem not a VS2k8 one. At my office, on my SQL Server 2005 installations (over XP as well as over Vista windows machines) there's no problem and crlf looks like it should. But at my client's SQL Servers (2005 and 2008) instalations, crlf looks like 2 squares. I was searching on Internet but I couldn't find the reason neither a solution. It's turnning me nuts.

hjoab