0
1

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.

GitでSJISを使う

Last updated at Posted at 2021-09-04

文字化け要素

コミットメッセージ

UTF-8固定と思われる
→格納:変更できない?(変更しないべき?)
表示:localeに合わせて変換してくれない

Git-bash(MINGW64)

locale(デフォルト)
LANG=ja_JP.UTF-8
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_ALL=
→.profile等で変更は可能

ターミナル

Options→TEXT→「locale,character set」
→変更可

ファイル名の表示(ls)

localeとターミナルの設定を合わせればUTF-8でもSJISでも問題無く表示される。

ファイルの内容

個別に違う
→.gitattributesで文字コードの設定は可能。
*.txt diff=sjis
ただし、それだけでは変換してくれない。
configにdiff用の変換指定(※)が必要
git config diff.sjis.textconv "iconv -f sjis"
※docx,xlsxをテキスト変換して比較する時とかも使える

pager

lessはSJISを扱えない為、SJISで処理したい場合はpagerの指定をブランクにする
git config core.pager ''

quotepathをoffにする(不要かも)

git config core.quotepath false

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?