首页 > 代码库 > The file contains a character that cannot be represented in the current code page

The file contains a character that cannot be represented in the current code page

场景说明:

    环境:VS2005,编辑C++代码,在类的构造函数的初始化列表中删除最后一个初始化变量,出现如下的错误:

The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss。

大意是:当前的编码页出现一些无法正常显示的字符,如果强制保存成unicode编码,可能导致数据丢失

代码简单如下:

    A::A():m_a(false),m_b(false).....,m_z(false)

{

}

删除最后一个m_z出现上述的问题,如果这种情况下,将左括号放在最后就不会出现任何的问题。


解决方案:

Ctrl+A选中当前的文档,然后点击文件,然后选中高级保存选项,在弹出的窗口中,选择如下:

编码(E):

Unicode(UTF-8带签名) - 代码页65001

行尾(L):

当前设置


The file contains a character that cannot be represented in the current code page