warning C4819: How to find the character that has to be saved in unicode?

后端 未结 5 1913
太阳男子
太阳男子 2021-01-30 22:57

I have seen the following warning recently through my VS2010.

Warning 21 warning C4819: The file contains a character that cannot be represented in the current code pag

5条回答
  •  半阙折子戏
    2021-01-30 23:59

    You can use Notepad++ to find all Unicode characters in a file using a regular expression:

    1. Open your file in Notepad++.
    2. Ensure that you select UTF-8 from the Encoding menu.
    3. Open the search box (use CTRL-F or go to the Search menu and select Find...).
    4. Under Search Mode, select the radio button for Regular expression.
    5. Enter [^\x00-\x7F] in the Find what box and hit the Find Next button to see what you get.

    After you find the Unicode character(s), you can remove/change them, change the encoding back to ANSI, and save the file.

    You don't have to use Notepad++, of course. The RegEx will work in other text editors, e.g., Sublime Text.

提交回复
热议问题