使用vs2019编译时报错:该字符在当前源字符集中无效(代码页 65001)
是gbk文件和utf-8文件混合编译导致的。
于是有以下解决方案:把gbk文件全部转化成utf-8
-
安装python
-
安装chardet
pip install chardet
-
编写python脚本(以下是可用内容,根据自己需求自己改)
import os import sys import chardet from codecs import open def detect_encoding(file): with open(file, 'rb') as f: result = c