如何更改 csharp 项目(visual studio/msbuild 机器)中的源文件编码? [英] how to change source file encoding in csharp project (visual studio / msbuild machine)?

查看:21
本文介绍了如何更改 csharp 项目(visual studio/msbuild 机器)中的源文件编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法强制 VS 始终使用 Unicode,而不是奇怪的 ISO 东西?

Is there a way to force VS to use Unicode always, instead of weird ISO-something?

我正在 Vista(波兰语环境)上使用 Visual Studio 2008 开发一个 winapp csproject.当我在 Win Server 2003(英语语言环境)上构建项目时出现问题 - 然后波兰语变音符号消失了.

I'm working on a winapp csproject using Visual Studio 2008 on Vista (Polish locale). The problem appears when I build the project on Win Server 2003 (English locale) - then Polish diacritic is gone.

我调查了该问题是由不正确的源文件编码引起的.看起来源文件没有使用 UTF-8 编码.

I investigated that the issue is caused by improper source file encoding. It looks that source files aren't using UTF-8 encoding.

推荐答案

问题:由于我刚刚添加的国际字符,从命令行启动的编译器无法处理源文件.

Problem: Compiler launched from command line cannot process the source file because of international characters that I’ve just added.

解决方案:以UTF-8编码显式保存源文件以保留国际字符.

Solution: Save source file explicitly in UTF-8 encoding to preserve international characters.

如何:

  • 在 Visual Studio 中打开有问题的文件.
  • 在文件菜单上单击高级保存选项"
  • 从编码"组合中选择Unicode (UTF-8 ..."
  • 点击确定.

你准备好了.承诺取悦构建服务器和等待绿色的团队其他成员.

You’re set. Commit to please the build server and rest of the team waiting for green.

这篇关于如何更改 csharp 项目(visual studio/msbuild 机器)中的源文件编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆