How to show ascii non-printable characters in Visual Studio Code? - ascii

I'm using Visual Studio Code version 1.51.1 and am wondering if there is any way to display all of the ascii non-printable characters when looking at a file. I used to use Notepad++ and it had a feature you could turn on that would show every character in a file including non-printable characters.
For example, here's a screenshot from a file open in Notepad++ that I've inserted the non-printable BEL character in by pressing ALT + 007. You can also see the carriage-return/line feeds at the end of the line:
Here's a list of the characters I'm referring to (I found this list here):
So what I'm asking is there an extension I can install into Visual Studio Code or a setting that I can configure that will show all ascii characters, both printable and non-printable, similar to how Notepad++ does it as shown in the screenshot I provided? Thanks in advance.

On the bottom-right corner of the status bar, you will see the encoding of the file. Click and select “Reopen with Encoding…” and change to something like UTF-8 or higher.
You can also search for the “Change File Encoding” task via Cmd+Shift+P.

Related

Removing Unicode character in Xcode

I often use OneNote for sample/template code which I can refer for any project. But When I copy from OneNote to Xcode I get below warning "Treating Unicode character as whitespace".
Though this is just a warning I like to see my code editor window warnings free. Is there any way to replace these Unicode character?
That happens to me, even converting the unicode text format didn't resolve this issue.
For a (hacky) solution, paste your code in apple-mail new message first, then copy and paste to Xcode, will correct this issue.

How do I explicitly set the code editor width in Visual Studio 2013 to 80 characters?

This is an IDE tools question.
I want to adhere to a specific style guide which wants me to have my code lines wrap to the next line if they exceed 80 characters on one line. When I select the word wrap option in Visual Studio 2013 text editor, it wraps the current window width of my project. How can I explicitly change my code editor window to be 80 characters in width without having to eyeball it?
Try this VS extension to add a visual guideline at the desired number of chars, then you can break your lines as needed when you approach the line. I'm reinstalling my laptop at the second so can't check, but I assume that the Visual Studio line-wrap option is only visually wrapping the text on your screen rather than actually breaking the line onto a subsequent line when it's over 80 (or width of screen in your case), which isn't really what the style guide you're following will be trying to get you to do.
If you had ReSharper installed, there is an option in that which allows the breaking of lines automatically at a given width.

Chinese characters showing as blank boxes in strings.xml

I am trying to cut and paste traditional Chinese characters as alternative resources in my values-zh-rTW/strings.xml file. They show as blank white boxes. As far as I can find, every encoding option is set to UTF-8. If it is a font issue, I'm not sure where to change the font or which font to change. I did go to General>Appearance>Colors and Fonts, but I'm not sure which font to adjust, if any. Please help if you've dealt with this before.
You might take a look at this question to make sure you're doing everything mentioned here:
How to support UTF-8 encoding in Eclipse
Here's another question that may have what you need:
How to print [Simplified] Chinese characters to Eclipse console?
I had the same problem and the solution was to install "East Asian Languages" in windows. Just go to control panel, Regional and Language Options, Languages tab, and then check Install files for East Asian languages (it required a windows cd for me).
There are some chinese characters in my eclipse editor. And it's not displayed correctly.
I change the project's text file coding by Cmd + I to show the project's Properties setting dialog. then in in put GBK in Text file encoding. then Apply it. the characters displayed correctly.
The screenshot is as below:

Visual Studio removes whitespace after closing tag

I have the problem that Visual Studio (or Resharper) removes whitespace after the tag when I use the formatting shortcut ctrl + k + d.
Example - before using the formatting shortcut:
<p>Sample text <b><span class="sometext"></span></b> fooo</p>
Example - after using the formatting shortcut:
<p>Sample text <b><span class="sometext"></span></b>fooo</p>
Ctrl+K+D runs Visual Studio formatter. To use ReSharper one, use Ctrl+E+C. But please note, that in HTML it can only fix indents for you - other spaces or new lines would stay intact.
P.S. One more shortcut for reformatting is Ctrl+E+F. First time when you invoke it you select profile (choose Reformat only and turn on using this profile by default for silent cleanup). Next time when you press Ctrl+E+F it would just silently reformat you code, without dialog.

Displaying Japanese fonts in source code using Visual Studio

I have some source files that have comments written in Japanese. When I open these files in Visual Studio they appear like this:
à–¾FNCAP‰¹—p‚̃XƒŒƒbƒh
I am using the English version of WinXP, but is there a way to get Visual Studio to display the actual Japanese characters rather than the random jibberish it currently is?
I found a general solution to the problem. This worked for me in Chinese text for Visual Studio 2013 and Windows 8.1.
per https://msdn.microsoft.com/en-us/library/ms246590.aspx
As Administrator Click Start, click Control Panel, and then open Regional and Language Options (or Region in Windows 8).
Click the Advanced tab. (or Administrative in Windows 8)
In the Select a language to match the language version of the non-Unicode programs you want to use list, select the language you are currently using.
Click OK.
Presumably VS is interpreting the file with the wrong encoding.
Reopen it using "File -> Open -> File... -> Open -> Open With... -> Source Code (Text) Editor With Encoding" and try various encodings.
Have you turned on support for Eastern languages for Windows? I have that turned on and I can see Chinese characters in Visual Studio 2005 on WinXP.
To turn it on you'll probably need the installation DVD for Windows. The setting is under Regional and Language Options in the Control Panel. I think you just need to check the "Install files for East Asian languages" option.
Microsoft's support page for internationalization has some screenshots and instructions.
I faced the same issue and have found a solution that works for me.
The problem is that the files aren't unicode and VS is trying to open them with an encoding that matches your location. Luckily, you can set Windows default behavior for non-unicode files. Check out this link, http://msdn.microsoft.com/en-us/library/ms246590.aspx. Look under "To correctly display characters that are not included in the current code page."
These directions are incorrect for Windows 8 (I can't speak for 7 or older.) For Windows 8:
Navigate to Control Panel
Select Clock, Language, and Region (yeah they still have the comma before and)
Region
Administrative
Change System Locale...
Select the desired language from the "Current System Locale" drop down
Most of your programs should continue to function in English as this setting is only applied when programs and files don't support unicode.
i have just gotten this problem and fixed it by changing config "files.encoding" in file "setting.json" . Go to Menu => File => Reference => setting to open the file. Search for "files.encoding" and change value to Encoding of your file (my file encoded in Shift-JIS , i checked ending by using Notpad++)
Windows 10 : --> Control Panel\Clock and Region\Region
You can also convert the text encoding to UTF-8 using Notepad++.
Originally encoded as Shift-JIS:
Convert to UTF-8:
Save file.
It should now display correctly regardless of local region.

Resources