Reputation: 203
I have a cpp file that uses ibm cp437 and Visual C++ keeps reading it with windows-1252. How do I make Visual C++ use the right code page for the file?
Upvotes: 5
Views: 13580
Reputation: 41
I also encountered these errors in my environments. I think there's any easier way to change the default code pages.
In windows 10, you could go to "Settings" -> "Region" -> "Administrative" tab -> "Language for non-Unicode programs". Then you could choose the region you want.
In this way, all the codes read from Visual Studio would use the code page whatever you want.
For example, the default setting for me is Chinese (Traditional, Taiwan). The code page is 950. But the codes are using windows-1252, therefore, I change the region to English (United States).
That's it.
Hope the solution could help you.
Thanks.
Upvotes: 4
Reputation: 203
Alright, I figured it out myself. For the curious, here is the answer:
Done.
Upvotes: 7
Reputation: 3647
Unless you need the CP437 encoding, why don't you convert it to CP1252, UTF-8 or MS 'Unicode' (UCS-2)? Any reasonably capable editor should be able to do it.
VS2008 can do it - check out the Advanced Save option on the File menu.
Edit:
If you go to Source Control Explorer, right-click on the file, select 'Properties', you can set the encoding on the 'General' tab page. 'IBM437' is one of the choices.
Upvotes: 0