perl/Encode - 7bit-jis != iso-2022-jp

| 1 Comment | 0 TrackBacks | このエントリーをはてなブックマークに追加 このエントリーのはてなブックマーク件数

Original: http://blog.livedoor.jp/dankogai/archives/51061651.html


ちょちょまwww


http://perl-mongers.org/2008/06/is2022jp.html

WIDE系 IRCで使われている、IS2022JPの(いわゆる)半角カナにはいろいろ種類がありますが、これをPerlでコード変換しようとした場合、 Encodeモジュールではコード変換に失敗してしまいます。(2008年6月6日0:20追記:Encodeモジュールでは半角カナの認識に失敗するだけで他のコードは自動認識します)

それは、文字コードそのものが微妙ながら決定的に違うのです。


http://search.cpan.org/perldoc?Encode::JP

  7bit-jis    /\bjis$/i         7bit JIS
  iso-2022-jp                   ISO-2022-JP                  [RFC1468]
                = 7bit JIS with all Halfwidth Kana 
                  converted to Fullwidth

半角カナをそのまま使いたかったら、7bit-jisをiso-2022-jpの代わりに指定すればよいだけです。ちなみにjisは、7bit-jisの別名として扱われます。


Dan the Encode Maintainer

No TrackBacks

TrackBack URL: http://perl-mongers.org/MT/mt-tb.cgi/51

1 Comment

エンコードの指定を間違えていたということですね。
ご指摘の内容で確認して、エントリの方を修正します。
大変勉強になりました。ありがとうございます。

Leave a comment

About this Entry

This page contains a single entry by dankogai [livedoor.com] published on June 6, 2008 12:11 PM.

IS2022JPの半角カナ対応 was the previous entry in this blog.

実用! Perlでプリンタのメーター確認をする is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

Creative Commons License
This blog is licensed under a Creative Commons License.
Powered by Movable Type 4.21-en