为什么文件编码类型为空?
我的文件有问题,我从备份中下载了文件不支持的文本编码。我使用一个小python脚本检查编码类型:
import chardet
import glob
print('')
print("File".ljust(45), "Encoding")
for filename in glob.glob('./*.js'):
with open(filename, 'rb') as rawdata:
result = chardet.detect(rawdata.read())
print(filename.ljust(45), result['encoding'])
这些是结果:
文件编码 。\ index.js无 。\ test.js ascii
我创建了一个新的JS文件“ test.js
”来检查脚本是否有效,是的,它正在工作,并且index.js
文件“损坏”或“损坏”(编码)。
是否有可能“修复”包围类型并能够打开它?
I'm having a problem with my files, I downloaded a file from a backup I had but when I open it in VSCode I get an error on my screen: The file is not displayed in the editor because it is either binary or uses an unsupported text encoding. I check the encoding type with a small python script:
import chardet
import glob
print('')
print("File".ljust(45), "Encoding")
for filename in glob.glob('./*.js'):
with open(filename, 'rb') as rawdata:
result = chardet.detect(rawdata.read())
print(filename.ljust(45), result['encoding'])
These are the results:
File Encoding .\index.js None .\test.js ascii
I created a new JS file "test.js
" to check that script works and... yep, it's working and the index.js
file is "broken" or "corrupted" (the encoding).
Is there any possibility to "fix" the enconding type and be able to open it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论