警告 C4819:如何找到必须以 unicode 保存的字符? [英] warning C4819: How to find the character that has to be saved in unicode?
问题描述
我最近通过我的 VS2010 看到了以下警告.
I have seen the following warning recently through my VS2010.
警告 21 警告 C4819:文件包含无法在当前代码页 (936) 中表示的字符.以Unicode格式保存文件以防止数据丢失
Warning 21 warning C4819: 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
c:\boost\vs2010_boost1.49\include\boost\format\alt_sstream_impl.hpp 1
基于 MSDN,该文件包含一个必须以unicode格式保存.
Based on MSDN, the file contains a character that has to be saved in unicode format.
问题:我自己没有接触过这些文件.有没有办法可以找到这些字符并手动更正它.换句话说,我不想以 unicode 格式保存源文件.
Question: I didn't touch those files myself. Is there a way that I can find those characters and correct it manually. In other words, I don't want to save the source file in unicode format.
谢谢
推荐答案
您可以使用 Notepad++使用正则表达式查找文件中的所有 Unicode 字符:
You can use Notepad++ to find all Unicode characters in a file using a regular expression:
- 在 Notepad++ 中打开您的文件.
- 确保从编码菜单中选择UTF-8.
- 打开搜索框(使用CTRL-F 或转到搜索 菜单并选择查找...).
- 在搜索模式下,选择正则表达式的单选按钮.
- 在查找内容框中输入
[^\x00-\x7F]
,然后点击查找下一个"按钮查看您得到的内容.
- Open your file in Notepad++.
- Ensure that you select UTF-8 from the Encoding menu.
- Open the search box (use CTRL-F or go to the Search menu and select Find...).
- Under Search Mode, select the radio button for Regular expression.
- Enter
[^\x00-\x7F]
in the Find what box and hit the Find Next button to see what you get.
找到 Unicode 字符后,您可以删除/更改它们,将编码改回 ANSI,然后保存文件.
After you find the Unicode character(s), you can remove/change them, change the encoding back to ANSI, and save the file.
当然,您不必使用 Notepad++.RegEx 将在其他文本编辑器中工作,例如 Sublime Text.
You don't have to use Notepad++, of course. The RegEx will work in other text editors, e.g., Sublime Text.
这篇关于警告 C4819:如何找到必须以 unicode 保存的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!