Juman::Encode(3pm)

Juman::Encode3pm

Character encoding functions

Overview

Perl-5.8.x は内部文字コードとして Unicode を採用している.そのため,日 本語 EUC を使っているプロセスとの入出力を行う場合や,日本語 EUC で記述 されたデータを参照する場合には,常に明示的に encode/decode を行う必要 がある.

このライブラリでは,そのための関数を定義している.

Functions

$octets = encode ( $string )

文字列を,"encoding" プラグマで指定されている文字コードで encode して, バイト列を得る.

$string = decode ( $octets )

バイト列を,"encoding" プラグマで指定されている文字コードで decode し て,文字列を得る.

set_encoding ( $handle )

指定されたファイルハンドルとの通信に,"encoding" プラグマで指定されて いる文字コードを使うように設定する.

いずれの関数も,"encoding" プラグマが指定されていない場合には,何もし ない.

Memo

このライブラリは,変数 "${^ENCODING}" を参照する必要のある関数の定義 を,一ヶ所にまとめるために導入した.なぜならば,変数 "${^ENCODING}" を参照しようとするコードは,Jperl-5.005 では syntax error となるためで ある.

  Sample Script:
    use English qw/ $PERL_VERSION /;
    if( $PERL_VERSION > 5.008 ){
        ${^ENCODING}->encode( ... );
    }
  Error Message:
    syntax error at sample.perl line 3, near "{^"

Pod errors

Hey! The above document had some coding errors, which are explained below:

Around line 14:

Non-ASCII character seen before =encoding in 'は内部文字コードとして'. Assuming UTF-8

Around line 108:

=over without closing =back

Releases

5 releases since Debian 8 (Jessie); the text changed 3 times.

  1. 8
  2. 9–10
  3. 12
  4. 13

Author

土屋 雅稔 <[email protected]>

From libjuman-perl 7.0-3.9 in Debian 13 (Trixie). Parsed by carta from the page's man source.