Bug caused by non printable character embedded by Visual Studio

喜欢而已 提交于 2019-12-11 01:33:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!