Reputation: 507
i don't see invisble characters in visual studio 2022 and i don't know why.
to realize it, I had to copy the line to notepad ++ and change the encoding to ANSI. The line is :
@Html.TextAreaFor(m => m.Notes, new {​​​​​​​​ @class = "form-control", @style = "min-height:6em; resize:vertical;" }​​​​​​​​)
If you change you're encodage to UTF-8, u will see invisble characters.how is this possible, normally we go to utf-8 to see the invisible characters?
The line in UTF8
@Html.TextAreaFor(m => m.Notes, new { @class = "form-control", @style = "min-height:6em; resize:vertical;" })
how can i see his characters in visual studio?
Thank you !
Upvotes: 1
Views: 2018
Reputation: 1823
You can use this Visual Studio extension to see the invisible characters in your code.
https://marketplace.visualstudio.com/items?itemName=ShaneRay.InvisibleCharacterVisualizer
Upvotes: 1
Reputation: 9523
I assume that for ANSI, you mean cp1252.
The text ​
in cp1252 is equivalent of the character U+200B in UTF-8, which it is the character for "ZERO WIDTH SPACE".
Such characters should be avoided in source code (but eventually on inline documentation). Usually the origin is a copy/paste from a website, where some hidden spaces are inserted in place of tags (e.g. to change font or colour). I consider this as a bug of such web-site, but also of the code copied. Note: maybe there is an other origin of such text (but a repeated sequence usually hints at such copy/paste errors).
Note: to me, it doesn't seem malicious use of Unicode characters (see recent CVEs for such malicious use on codes), but because these recent CVEs, I really recommend to remove such characters.
For more information, you can check https://en.wikipedia.org/wiki/Zero-width_space (for this character), and a list of other white spaces (and zero width spaces) in https://en.wikipedia.org/wiki/Whitespace_character.
Upvotes: 1