CYGWIN 日本語メッセージの文字化けに対応する

以下サイトを参考。感謝。

http://osada113.blog94.fc2.com/blog-entry-221.html

 

日本語メッセージの文字化けに対応する

環境変数 LANG に「ja_JP.SJIS」を設定しているのに、Cygwin のコマンドの出力が文字化けする…
といった事態に困っているユーザも多いのではないでしょうか。 ここでは、この問題への対処方法について説明します。


nkfのダウンロード・インストール
http://cygwin-je.sourceforge.jp/cygwin_je/release/nkf/

ダウンロードしてきたファイルを解凍し
/usr/bin/nkf.exeを cygwim/bin以下へコピー
/usr/shareフォルダ以下をcygwin/share以下へコピー

moconv.shをダウンロード、実行
http://www.sixnine.net/cygwin/cygwin-doc/japo.html

moconv.shの内容を適宜変更

NKF=/usr/bin/nkf
SED=/usr/bin/sed
MSGFMT=/usr/bin/msgfmt
MSGUNFMT=/usr/bin/msgunfmt

NKF=/bin/nkf
SED=/bin/sed
MSGFMT=/bin/msgfmt
MSGUNFMT=/bin/msgunfmt

moconv.shを実行

sh moconv.sh
実行結果↓
HOGE:~$ sh moconv.sh
/usr/share/locale/ja/LC_MESSAGES/alternatives.mo
/usr/share/locale/ja/LC_MESSAGES/coreutils.mo
/usr/share/locale/ja/LC_MESSAGES/diffutils.mo
/usr/share/locale/ja/LC_MESSAGES/findutils.mo
/usr/share/locale/ja/LC_MESSAGES/gawk.mo
/usr/share/locale/ja/LC_MESSAGES/gettext-runtime.mo
/usr/share/locale/ja/LC_MESSAGES/gettext-tools.mo
/usr/share/locale/ja/LC_MESSAGES/grep.mo
/usr/share/locale/ja/LC_MESSAGES/sed.mo
/usr/share/locale/ja/LC_MESSAGES/tar.mo
/usr/share/locale/ja/LC_MESSAGES/texinfo.mo

moconv.sh: /usr/bin/msgfmt not found.
とかいわれる場合は
cygwinのsetup.exeからカテゴリ「devel」の「gettext」をインストール

1 コメント:

cocoa

2011年3月14日 20:38

参考:
Cygwin/日本語化 - Co-Coa Wiki
http://co-coa.sakura.ne.jp/index.php?Cygwin%2F%E6%97%A5%E6%9C%AC%E8%AA%9E%E5%8C%96