Check if file contains multibyte character

旧街凉风 提交于 2019-12-23 12:40:46

问题


I have some subtitle files in UTF-8. Sometimes there are some sporadic multibyte characters in these files which cause problem in some applications.

How do I check in linux (and possibility locate these) if a certain file contains any multibyte character.


回答1:


You can use file command

chalet16$ echo test > a.txt
chalet16$ echo testก >  b.txt #One of Thai characters
chalet16$ file *.txt
a.txt: ASCII text
b.txt: UTF-8 Unicode text



回答2:


You can use file or chardet command.



来源:https://stackoverflow.com/questions/10373258/check-if-file-contains-multibyte-character

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!