- 追加された行はこの色です。
- 削除された行はこの色です。
5.8.x な文字コード関連のメモ
#contents
* ソースの文字コードを指定
use encoding 'euc-jp';
use encoding 'utf8';
* 標準出力などの文字コードを指定
# eucで出力されるようになる
use open OUT => ':encoding(euc-jp)';
# 上だけだと標準出力などに影響がないのでこれがいる
use open ':std';
* 3引数open
use Encode;
# sjisでファイルに出力
oprn OUT, ">:encoding(shiftjis)", $path;
// # sjisのファイルを読み込む
// open IN, "<:encoding(shiftjis)", $path;
// # PerlIOを通さず出力
// open OUT, ">", $path;
* 参考
- http://www.pure.ne.jp/~learner/program/Perl_unicode.html
- http://www.context.co.jp/perlinfo/tech-notes/lecture-perl5.8-20020725/
- perldoc
-- perluniintro [[和訳>http://perldoc.jp/docs/perl/5.8.1/perluniintro.pod]]
-- perlunicode
-- open [[和訳>http://perldoc.jp/docs/perl/5.8.1/open.pod]]
-- encoding
-- utf8 [[和訳>http://perldoc.jp/docs/perl/5.8.1/utf8.pod]]
-- Encode