问题
I have some cross platform code that I regularly share between Visual Studio and Xcode (and Vim).
At some point, I modified a string in this code, using Visual Studio. That string somehow ended up with an errant '^H' control character (ASCII 0x08) embedded in it.
The trouble is, this control character is non-printable. It wasn't visible in Visual Studio, nor was it visible in Xcode.
Viewing the source in Vim, I could clearly see the problem. Vim helpfully displays the control character, and problem solved.
Interestingly, when viewing the source via Xcode I can navigate through the string with the cursor - it clearly knows the character is there, as the cursor remains in the same location when traversing over the non-printable character.
So..
How can I prevent Visual Studio from inserting errant control characters in the first place? I presume this is a bug and should never happen.
Is there any way to have Visual Studio display such control characters, without also showing spaces/tabs?
Is there any way to have Xcode display such control characters, without also showing spaces/tabs?
Both environments have an equivalent 'Editor->Show Invisibles' but it's a bit of an all or nothing.. It's not something I want on all the time.
来源:https://stackoverflow.com/questions/45445458/bug-caused-by-non-printable-character-embedded-by-visual-studio