折腾:
期间,需要去搞清楚一个python的文件,本身的文件的编码是什么
确保转换为utf-8
centos detect file encoding
(SIPEvents) ➜ SIPEvents file migrations/versions/008986972eeb_.py -i migrations/versions/008986972eeb_.py: text/x-python; charset=utf-8 |
shell – How to find encoding of a file in Unix via script(s) – Stack Overflow
Determine and change file character encoding | mindspill.net
HowTo : Determine and Change File Character Encoding | Linux Commands
linux – How to auto detect text file encoding? – Super User
[总结]
可以通过:
file -i your_file_name
去检测文件的基本信息,其中包括字符编码charset
比如:
file migrations/versions/008986972eeb_.py -i migrations/versions/008986972eeb_.py: text/x-python; charset=utf-8 |
转载请注明:在路上 » [已解决]CentOS中判断检测一个Python文件的编码