如何更改 MS Visual Studio 2008 用于打开文件的代码页?

发布于 2024-08-23 11:46:39 字数 93 浏览 4 评论 0原文

我有一个使用 ibm cp437 的 cpp 文件,Visual C++ 继续使用 windows-1252 读取它。如何使 Visual C++ 使用该文件的正确代码页?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

娇女薄笑 2024-08-30 11:46:39

好吧,我自己想出来了。对于好奇的人来说,答案如下:

  • 右键单击解决方案资源管理器中的文件。
  • 选择“打开方式...”
  • 选择“C++ 源代码编辑器(带编码)”
  • 将出现一个新框来指定编码。选择“OEM United States - Codepage 437”

完成。

Alright, I figured it out myself. For the curious, here is the answer:

  • Right click the file in the Solution Explorer.
  • Select "Open With..."
  • Choose "C++ Source Code Editor (with encoding)"
  • A new box appears to specify Encoding. Choose "OEM United States - Codepage 437"

Done.

为你拒绝所有暧昧 2024-08-30 11:46:39

我在我的环境中也遇到了这些错误。我认为有更简单的方法来更改默认代码页。

在 Windows 10 中,您可以转到“设置”-> 「地区」-> “管理”选项卡-> “非 Unicode 程序的语言”。然后你可以选择你想要的区域。

这样,从 Visual Studio 读取的所有代码都将使用您想要的代码页。

例如,我的默认设置是中文(繁体,台湾)。代码页是950。但是代码使用的是windows-1252,因此,我将区域更改为英语(美国)

就是这样。

希望解决方案可以帮助您。

谢谢。

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.

手长情犹 2024-08-30 11:46:39

除非您需要 CP437 编码,否则为什么不将其转换为 CP1252、UTF-8 或 MS 'Unicode' (UCS-2)?任何有能力的编辑都应该能够做到。

VS2008 可以做到这一点 - 查看“文件”菜单上的“高级保存”选项。

编辑:

如果您进入源代码管理资源管理器,右键单击该文件,选择“属性”,您可以在“常规”选项卡页上设置编码。 “IBM437”是选择之一。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文