How can I get Visual Studio 2010 to show Chinese comments properly - visual-studio

I have some code from a Chinese business partner, and all of the comments in the code are in Chinese. However, Visual Studio displays them as gibberish. How can I get them to display properly. Here is a code example with some comments converted to gibberish:
//Á¬½Óµ½·þÎñÆ÷
void CTestAPIDlg::OnBnClickedButton2()
{
UpdateData(TRUE);
//ÉèÖÃÊÇ·ñ¼Ç¼ÈÕÖ¾
m_ObjRSI->EnableLog(m_bIsOnLogReg,m_bIsOnLogComm);
//ÅжÏÊÇ·ñÆôÓôúÀí
if (m_bIsOnProxy)
{
//´úÀí²ÎÊý
char proxyIP[64];
ZeroMemory(proxyUserPwd,sizeof(proxyUserPwd));
//×¢£º´Ë´¦ÒòΪÊÇʹÓÃunicode±àÒ룬ËùÒÔÒª×Ö·ûת»»£¬ÏÂͬ.
WideCharToMultiByte(CP_ACP,0,m_strProxyIP,-1,proxyIP,64,NULL,NULL);
etc...
Thanks in advance for any help...

Ask your partner to save the source code file encoded in UTF-16 or UTF-8. It is still not the default encoding for C++ source code, Unicode is slow to catch up. File + Save As, click on the arrow of the Save button, Save with Encoding, choose UTF-8.
You should be able to do this yourself as well. File + Open, select the .cpp file(s), click on the arrow of the Open button, Open With, select "C++ Source Code Editor (with encoding)". Pick the correct Chinese encoding (there are several to choose from) from the Encoding dialog box.

You can use applocale, download it from here: http://www.microsoft.com/en-us/download/details.aspx?id=13209.
This is an old app but works well on Win7 and Win8 (tested). When installing, simply make sure to run it as admin. Then later on, run devnev.exe (visual studio) using applocale and set the locale to Chinese. I just tested this works perfectly well.

For 2021 Chinese reader using Visual Studio 2019:
On Windows, the Visual Studio 2019 Community is default to use Big5 encoding.

Related

Modify Toolbar for MFC MS Visual Studio 2019 app with Gimp

I'm trying to modify a toolbar's BMP file with GIMP 2.10.24 (tried with 2.9, too) for a MFC application in Visual Studio 2019's resource editor.
Using these explanations, I can save the BMP file so that it opens in Visual Studio.
I also set the mode to RGB and made sure there is no alpha channel.
The title of the MS VS editor reads
0x0, 1 bit, BMP
just like before.
The app builds OK, but when I run it,
VERIFY(toolBar->LoadToolBar(nID));
fails with an exception.
Is there anything else I need to do to make my toolbar load again?
Thanks in advance!
I finally worked out a solution that works with recent versions of GIMP (thanks to everyone who contributed!):
Do NOT convert to RGB! The confusion comes from the fact that ‘Advanced options’ is only active if you convert to RGB, but you do not need the advanced options. Maybe that changed at one point in MSVS or in GIMP, because explanations on different forums are confusing about this point...
Image/Mode -> Indexed colors (DO NOT CHANGE THIS)
File/Export as ... :
Run-Length encoded : do not check
Compatibility options : do not write color space information : check
Advanced options : is not accessible, but that DOESN'T MATTER !
Additional trick: you can copy-paste the buttons of toolbars (not the entire toolbar) one by one from Gimp to VS (if the color settings in Gimp are as explained above ; if not, you loose / mix up the colors).
Tested with Microsoft Visual Studio 2019 enterprise edition and GIMP 2.10.

How to open windows terminal settings.json as Vs code?

I'm Korean I have an issue toady
recently I have tried to make a development atmosphere on windows. (because I just used Anaconda. I want to make totally new env)
so I set up Ubuntu 18.04 and many things following a youtube.
when the YouTuber press [Crtl + , ] in windows terminal, it opens as VS code
but my shoes, it opens as text file!!! (below picture)
what's wrong with me??
How can I fix it?
Plz give your intelligent idea
make .json file anywhere (like Desktop) and right click that file, click open with (in Korean 연결 프로그램), unless you can't find Visual Studio Code, choose choose another app (in Korean 다른 앱 선택).
Click Visual Studio Code in the following window.

Visual studio code wraps html too much

I have updated visual studio code to latest version.
It just changed formatting in html files. All my html file changes when i format again.
It wraps like we are coding in tablet mode leaving empty space like below
Can anyone help me with this. It creates issue when more then one developer is working on same project. Just slight different version of visual studio code changes format.
If you want to turn the wrap line length you can go to Preferences -> Settings and search for wrap. There you will find HTML › Format: Wrap Line Length and you can change that value.

How to set up default encoding in Visual Studio 2010

We're using Visual Studio 2010 professional to develop and maintain our company ASP (classic ASP, not ASP.NET) e-commerce web site, and I'm having file encoding issues every time I create a new page.
Every page in our web site is saved as Windows-1252, and when I create a new page (or randomly when I modify an existing one) Visual Studio saves the page using the UTF-8 encoding, screwing up extended characters or #includes (since the included file is saved as Windows-1252 and the page including it is UTF-8, when displayed the included content goes haywire).
I've tried searching everywhere, but the only solution I found is "Save every file manually with "File" → "Save as" → "Save with encoding", which is quite an hassle to do every time (and I'm totally going to forget to do it sometime).
I already tried deselecting the option "Save documents as Unicode when data cannot be saved in codepage" in "Environment" → "Documents" settings but to no avail.
Am I really stuck with the manual thing?
I'm way late answering this, but I had the issue myself and this is the first hit on google, so I'll document it here if anyone else wants to know. :)
The default encoding of a new file in Visual Studio depends on the template for that kind of file.
The JavaScript file template for instance recides in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Web\WebNewFileItems\JScript.js (on my box).
If you edit that file and save it with your encoding of choice, all new javascript files created with VS will be of that encoding.
Hence you can set the encoding of each file type independently.
I don't know if there is a setting in VS to change the default encoding (though I highly doubt it). You can however quite easily write a little add-in that gives you a "Save as 1252" command which can then be mapped into any menu you like.
Lars-Erik's answer does the trick.
Just add some information:
For those who want to change default encoding of MFC files, here're the templates:
...\Microsoft Visual Studio 10.0\VC\VCWizards\CodeWiz\MFC\Simple\Templates\LANG_CODE
LANG_CODE is the language of your VS 2010 (1033: en-us, 2052: zh-cn, etc.)
In my case, the language of VS is en-us, and MFC template files
are all written in English (only ASCII characters) without UTF8 BOM, which
means they can be interpreted as either a UTF8 file or a file in my OS code
page (cp932). Files created by those templates are treated in cp932 instead of
Unicode by default, so I have to add BOM to those templates to make VS 2010
save files explicitly in UTF8 (also with BOM).
Can't find it, but builtin workaround is, File > Save As > then where the save button is, there is a Down arrow, give you the option of "Save with Encoding"
I select US ASCII Cause I'm getting the BOM on all my documents, once published.

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