LoginSignup
2
1

More than 1 year has passed since last update.

Cygwinで変更になった一部全角幅文字の扱いを元に戻す

Posted at

以前のCygwinでは、LANGがja_JP.UTF-8の場合、ギリシャ文字(αβγ)や矢印(⇒→)、罫線(─│)などのEast Asian WidthでAmbiguous(曖昧)に属す文字は全角扱いされるようになっていましたが、最近のバージョンアップでこのような特別扱いが除去(=半角扱いに変更)されました。(どのバージョンからは把握していないのですが)

参考: drop ambiguous-wide behaviour from Unicode CJK locales

変更前:

-These characters have a width of 1 for singlebyte charsets and a width of 2
-for multibyte charsets other than UTF-8.
-For UTF-8, their width depends on the language specifier:
-it is 2 for <<"zh">> (Chinese), <<"ja">> (Japanese), and <<"ko">> (Korean),
-and 1 for everything else. Specifying <<"cjknarrow">> or <<"cjkwide">>
-forces a width of 1 or 2, respectively, independent of charset and language.

変更後:

+These characters have a width of 1 for singlebyte charsets and UTF-8,
+and a width of 2 for multibyte charsets other than UTF-8. Specifying
+<<"cjknarrow">> or <<"cjkwide">> forces a width of 1 or 2, respectively.

この仕様変更後も、「曖昧」な文字を全角幅文字扱いしたい場合は、環境変数LANGに「ja_JP.UTF-8@cjkwide」を設定する必要があります。

具体的には以下の設定を追加/変更します。

  • Windowsの環境変数設定1で、環境変数LANGに「ja_JP.UTF-8@cjkwide」を設定する。
  • MinTTYのオプション→テキストで、「文字セット」の箇所に「UTF-8@cjkwide」を設定する。

  1. 開き方はいろいろあるが、例えば、Explorerの「PC」を右クリック→「プロパティ」→「システムの詳細設定」→「システムのプロパティ」ダイアログの「詳細設定」タブ→「環境変数」。なお、設定箇所はユーザー環境変数でもシステム環境変数でもどちらでもよい。 

2
1
1

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