LoginSignup
1
0

More than 5 years have passed since last update.

EUC環境で作られたPerlスクリプトでの文字化け対応

Posted at

いまだに文字化けの修正依頼があるので忘れないようにメモしときます。

CPANから日本語文字コード変換のモジュールをインストール

$ cpan
cpan> install Unicode::Japanese

Shift_JISからEUC-JPへ文字コードを変換

# use Jcode; 
use Unicode::Japanese;

# Jcode::convert(\$value, "euc", "sjis");
# sjis -> utf8
$value = Unicode::Japanese->new($value, 'sjis')->get;
# utf8 -> euc
$value = Unicode::Japanese->new($value)->euc;
1
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
1
0