如何确定文本文件的编码表 [英] How to determine encoding table of a text file

查看:137
本文介绍了如何确定文本文件的编码表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 .txt .java 文件,我不知道如何确定编码表文件(Unicode,UTF-8,ISO-8525,...)。是否存在确定文件编码或查看编码的任何程序?

I have .txt and .java files and I don't know how to determine the encoding table of the files (Unicode, UTF-8, ISO-8525, …). Does there exist any program to determine the file encoding or to see the encoding?

推荐答案

如果您使用的是Linux,请尝试 file -i filename.txt

If you're on Linux, try file -i filename.txt.

$ file -i vol34.tex 
vol34.tex: text/x-tex; charset=us-ascii

为了参考,这里是我的环境:

For reference, here is my environment:

$ which file
/usr/bin/file
$ file --version
file-5.09
magic file from /etc/magic:/usr/share/misc/magic

一些文件版本(例如OS / X上的file-5.04)有不同的命令行开关:

Some file versions (e.g. file-5.04 on OS/X) have slightly different command-line switches:

$ file -I vol34.tex 
vol34.tex: text/x-tex; charset=us-ascii
$ file --mime vol34.tex
vol34.tex: text/x-tex; charset=us-ascii

另外,看看 here

这篇关于如何确定文本文件的编码表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆