0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

2022-07-22 Git-bash を利用して、Windows 上でファイルのエンコーディングを確認する

Posted at

環境

  • 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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?