環境
- Windows 10
- MinGW
$ bash --version
GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
方法
file -i
コマンドを利用して確認する。
$ file --help
Usage: file [OPTION...] [FILE...]
Determine type of FILEs.
...(中略)...
-i, --mime output MIME type strings (--mime-type and
--mime-encoding)
--apple output the Apple CREATOR/TYPE
--extension output a slash-separated list of extensions
--mime-type output the MIME type
--mime-encoding output the MIME encoding
今回は、ファイルのエンコーディングが Shift JIS であることを確認したかった。
Shift JIS の場合は、 unknown-8bit と表示されるらしい。
$ file -i ./Downloads/test.csv
./Downloads/test.csv: application/csv; charset=unknown-8bit