1. 程式人生 > >如何查看文件的編碼

如何查看文件的編碼

custom little 一個 nco dia ack -1 文件的 odin

https://www.shellhacks.com/linux-check-change-file-encoding/

在某一個目錄下,直接執行file *

$ file *
chucklu.autoend.js: HTML document, UTF-8 Unicode text, with very long lines, with CRLF line terminators
custom.css: UTF-8 Unicode text, with CRLF line terminators
SimpleMemory.css: UTF-8 Unicode text, with CRLF line terminators

$ file *
chucklu.autoend.js: HTML document, Little-endian UTF-16 Unicode text, with very long lines, with CRLF line terminators
custom.css: UTF-8 Unicode text, with CRLF line terminators
SimpleMemory.css: UTF-8 Unicode text, with CRLF line terminators

$ file -bi chucklu.autoend.js
text/html; charset=utf-8

$ file -bi custom.css
text/plain; charset=utf-8

-b,--brief Don’t print filename (brief mode)

-i, --mime Print filetype and encoding

如何查看文件的編碼