man Jcode::Nihongo () - ÆüËܸìʸ»ú½¸¹ç¥Ï¥ó¥É¥é

̾Á°

Jcode - ÆüËܸìʸ»ú½¸¹ç¥Ï¥ó¥É¥é

³µÍ×

 use Jcode;
 # 
 # ¸Å¼°¤æ¤«¤·¤¯
 Jcode::convert($str, $ocode, $icode, "z");
 # ¤â¤·¤¯¤Ï¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¤Ç¡ª
 print Jcode->new($str)->h2z->tr($from, $to)->utf8;

ÀâÌÀ

Jcode.pm¤Ï¥ª¥Ö¥¸¥§¥¯¥ÈŪ¤Ê¥¢¥×¥í¡¼¥Á¤È½¾Í褫¤é¤Î¥¢¥×¥í¡¼¥Á¤ÎξÊý¤ò ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£¥ª¥Ö¥¸¥§¥¯¥ÈŪ¤Ê¥¢¥×¥í¡¼¥Á¤ò»È¤¨¤Ð¤³¤ó¤Ê´¶¤¸¤Ç¡¨

  $iso_2022_jp = Jcode->new($str)->h2z->jis;

¤³¤Á¤é¤è¤ê¥¨¥ì¥¬¥ó¥È¤Ç¤·¤ç¤¦¡§

  $iso_2022_jp = $str;
  &jcode::convert(\$iso_2022_jp, 'jis', &jcode::getcode(\$str), "z");

¥ª¥Ö¥¸¥§¥¯¥È¤ËÆëÀ÷¤ß¤Î̵¤¤¿Í¤Î¤¿¤á¤Ë¡¢Jcode.pm¤Ï¤Þ¤ÀCWgetcode()¤È CWconvert()¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£

Perl¤Î¥Ð¡¼¥¸¥ç¥ó¤¬5.8.1°Ê¾å¤Ê¤é¡¢Jcode¤Ï¡¢Perl 5.8°Ê¹ß¤Îɸ½àŪ¤Êʸ»ú½¸¹ç ¥Ï¥ó¥É¥é¥â¥¸¥å¡¼¥ë¤Ç¤¢¤ëEncode¤Î¥é¥Ã¥Ñ¡¼¤È¤·¤Æ¿¶¤ëÉñ¤¤¤Þ¤¹¡£

¥á¥½¥Ã¥É

Æä˸ÀµÚ¤·¤Ê¤¤¸Â¤ê¡¢¤³¤³¤Çµó¤²¤ë¥á¥½¥Ã¥É¤ÏÁ´¤ÆJcode¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤·¤Þ¤¹¡£

¥³¥ó¥¹¥È¥é¥¯¥¿

$str¤«¤éJcode¥ª¥Ö¥¸¥§¥¯¥È$j¤òÀ¸À®¤·¤Þ¤¹¡£ÌÀ¼¨Åª¤Ë$icode¤ò¥»¥Ã¥È¤·¤Ê¤±¤ì¤Ð¡¢ ÆþÎÏ¥³¡¼¥É¤Ï¼«Æ°Åª¤ËȽÄꤵ¤ì¤Þ¤¹¡£ÍøÍѲÄǽ¤Êʸ»ú½¸¹ç¤Ë¤Ä¤¤¤Æ¤Ï¡¢²¼¤Î getcode¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢CW$icode¤Ë¤ÏEncode¤¬Íý²ò¤Ç¤­¤ë ¤É¤ó¤Ê¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾¤â»È¤¨¤Þ¤¹¡£

  $j = Jcode->new($european, 'iso-latin1');
¥ª¥Ö¥¸¥§¥¯¥È¤òʸ»úÎ󲽤¹¤ë¤È¡¢EUC¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤¬ÊÖ¤ê¤Þ¤¹¡£¤Ç¤¹¤«¤é CWprint $j->euc¤È¤¹¤ëÂå¤ï¤ê¤Ë¡¢CWprint $j¤È¤Ç¤­¤Þ¤¹¡£
¥ê¥Õ¥¡¥ì¥ó¥¹ÅϤ·
¥¹¥«¥é¡¼ÃͤÎÂå¤ï¤ê¤Ë¡¢°Ê²¼¤Î¤è¤¦¤Ë¥ê¥Õ¥¡¥ì¥ó¥¹¤òÅϤ»¤Þ¤¹¡£
 Jcode->new(\$str);
¤³¤ì¤Ï¤Û¤ó¤Î¾¯¤·»þ´Ö¤òÀáÌó¤·¤Þ¤¹¡£¤½¤ÎÂå½þ¤È¤·¤Æ¡¢$str¤ÎÃͤ½¤Î¤â¤Î¤¬ ÊÑ´¹¤µ¤ì¤Þ¤¹¡Ê¤¢¤ë°ÕÌ£¡¢$str¤Ïjcode¥ª¥Ö¥¸¥§¥¯¥È¤Ëtie¤µ¤ì¤ë¤Î¤Ç¤¹¡Ë¡£ $j¤ÎÆâÉôʸ»úÎó¤Ë$str¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£·«¤êÊÖ¤·Jcode¥ª¥Ö¥¸¥§¥¯¥È¤ò»È¤¦¤È¤­¤Ë ÊØÍø¤Ç¤¹¡Ê¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë»þ´Ö¤È¥á¥â¥ê¤ÎÀáÌó¤Ë¤Ê¤ê¤Þ¤¹¡Ë¡£
 # mailbox¤òSJIS·Á¼°¤ËÊÑ´¹
 my $jconv = new Jcode;
 $/ = 00;
 while(<>){
     print $jconv->set(\$_)->mime_decode->sjis;
 }
$j¤ÎÆâÉôʸ»úÎó¤Ë$str¤ò²Ã¤¨¤Þ¤¹¡£ Jcode->new() ¤Îû½Ì·Á¡£°Ê²¼¤Î¤è¤¦¤Ë¤Ç¤­¤Þ¤¹¡¨
 $sjis = jcode($str)->sjis;

ʸ»úÎó¤Î¥¨¥ó¥³¡¼¥É

°ìÈ̤ˡ¢$j->encoded¤È¤¹¤ë¤³¤È¤Çencoded¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤òÆÀ¤Þ¤¹¡£ ¼«ÌÀ¤Ç¤·¤ç¤¦¡£ WYCIWYG = What you code is what you get :) CW$j->h2z->jis¤ÈƱ¤¸¤Ç¤¹¡£ Ⱦ³Ñ¥«¥Ê¤Ï¶¯À©Åª¤ËÁ´³Ñ¤ËÊÑ´¹¤µ¤ì¤Þ¤¹¡£ Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢Encode¤¬¥µ¥Ý¡¼¥È¤¹¤ë¤É¤ó¤Ê¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾¤È ¥¨¥¤¥ê¥¢¥¹¤Ç¤âÍøÍѤǤ­¤Þ¤¹¡£Î㤨¤Ð¡§

  $european = $j->iso_latin1; # ¥á¥½¥Ã¥É̾ÍѤË'-'¤Ï'_'¤ËÃÖ¤­´¹¤¨¤Þ¤¹
»²¹Í¡§Encode::Encoder¤¬¤³¤ì¤ÈƱ¤¸¾®µ»¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£
$j->fallback($fallback)
Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢Jcode¤ÏÆâÉô¤Îʸ»úÎó¤òUTF-8¤ÇÊÝ»ý¤·¤Þ¤¹¡£ ->encoding¤Ë¥Þ¥Ã¥×¤Ç¤­¤Ê¤¤Ê¸»ú¤Ï'?'¤ËÃÖ¤­´¹¤¨¤é¤ì¤Þ¤¹¤¬¡¢ ¤³¤ì¤ÏEncode¤Ç¤Îɸ½àÆ°ºî¤Ç¤¹¡£
  my $unistr = "\x{262f}"; # ±¢ÍÛ¥Þ¡¼¥¯
  my $j = jcode($unistr);  # $j->euc ¤Î·ë²Ì¤Ï '?' ¤Ë
¤³¤Î¿¶¤ëÉñ¤¤¤Ï¡¢EncodeƱÍÍ¡¢¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¤ò»ØÄꤹ¤ë¤³¤È¤ÇÊѹ¹¤Ç¤­¤Þ¤¹¡£ ÃͤÏEncode¤Î¤â¤Î¤È°ì½ï¤Ç¤¹¡£Êص¹¤Î¤¿¤á¡¢CWJcode::FB_PERLQQ¡¢ CWJcode::FB_XMLCREF¡¢CWJcode::FB_HTMLCREF¤¬Encode¤Î¤½¤ì¤é¤Ø¤Î ¥¨¥¤¥ê¥¢¥¹¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
  print $j->fallback(Jcode::FB_PERLQQ)->euc;   # '\x{262f}'
  print $j->fallback(Jcode::FB_XMLCREF)->euc;  # '&#x262f;'
  print $j->fallback(Jcode::FB_HTMLCREF)->euc; # '&#9775;'
¥°¥í¡¼¥Ð¥ëÊÑ¿ôCW$Jcode::FALLBACK¤Ë¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¤¬ÊÝ»ý ¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤³¤ÎÃͤòÂåÆþ¤¹¤ë¤³¤È¤Ç¥ª¡¼¥Ð¡¼¥é¥¤¥É¤Ç¤­¤Þ¤¹¡£
  $Jcode::FALLBACK = Jcode::FB_PERLQQ; # ¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¥¹¥­¡¼¥Þ¤òÀßÄê
$width¡Ê¥Ç¥Õ¥©¥ë¥È¡§72¡ËËè¤Ëjcodeʸ»úÎóÆâ¤Î¹Ô¤òÀÞ¤êÊÖ¤·¤Þ¤¹¡£ CW$width¤Ï¡ÉȾ³Ñ¡Éʸ»ú¤Î¿ô¤Ç¤¹¡£Á´³Ñʸ»ú¤Ï2ʸ»ú¤È¤·¤Æ¥«¥¦¥ó¥È¤·¤Þ¤¹¡£ $newline_str¡Ê¥Ç¥Õ¥©¥ë¥È¤Ï\n¡Ë¤Ç»ØÄꤵ¤ì¤¿²þ¹Ôʸ»ú¤¬²Ã¤ï¤ê¤Þ¤¹¡£ ÀÞ¤êÊÖ¤µ¤ì¤¿Á´¹Ô¤ò¥ê¥¹¥È¤ÇÊÖ¤·¤Þ¤¹¡£ Perl 5.8.1°Ê¹ß¤Ï3ÈÖÌܤΰú¿ô$kref¤ËEUC¤Îʸ»úÎó¤ÎÇÛÎó¥ê¥Õ¥¡¥ì¥ó¥¹¤ò ÅϤ¹¤³¤È¤Ç¡¢´Ê°×Ū¤Ê¹ÔƬ¶Ø§½èÍý¡Ê¤Ö¤é²¼¤¬¤ê¡Ë¤ò¹Ô¤¨¤Þ¤¹¡£ ¥Ð¥¤¥ÈĹ¤Ç¤Ï¤Ê¤¯¡¢Á´³Ñʸ»ú¤â°ìʸ»ú¤È¤·¤Æ¿ô¤¨¤¿¾ì¹ç¤Îʸ»ú¿ô¤òÊÖ¤·¤Þ¤¹¡£

MIME::Base64¤ò»È¤¦¥á¥½¥Ã¥É

²¼µ­¤Î¥á¥½¥Ã¥É¤ò»È¤¦¤Ë¤Ï¡¢MIME::Base64¤¬É¬ÍפǤ¹¡£¥¤¥ó¥¹¥È¡¼¥ë¤Ïñ½ã¤Ë

   perl -MCPAN -e 'CPAN::Shell->install("MIME::Base64")'

¤È¤·¤Þ¤¹¡£¤ª»È¤¤¤ÎPerl¤¬5.6°Ê¹ß¤Ç¤¢¤ë¤Ê¤é¡¢MIME::Base64¤Ï ¥Ð¥ó¥É¥ë¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢¥¤¥ó¥¹¥È¡¼¥ë¤ÎɬÍפϤ¢¤ê¤Þ¤»¤ó¡£ $str¤òRFC1522¤Ë¤¢¤ëMIME-Header¤ËÊÑ´¹¤·¤Þ¤¹¡£$lf¤ò»ØÄꤹ¤ë¤È¡¢ ¹Ô¤ÎÀÞ¤êÊÖ¤·¤Ë$lf¤¬»È¤ï¤ì¤Þ¤¹¡Ê¥Ç¥Õ¥©¥ë¥È¡§\n¡Ë¡£ CW$bpl¤ò»ØÄꤹ¤ë¤È¡¢ÀÞ¤êÊÖ¤¹¥Ð¥¤¥È¿ô¤Ë$bpl¤¬»È¤ï¤ì¤Þ¤¹¡Ê¥Ç¥Õ¥©¥ë¥È¡§76¡¨ ¤³¤Î¿ôÃͤÏ76°Ê²¼¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡Ë¡£ Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Æ¤âMIME Header¥¨¥ó¥³¡¼¥É¤¬¤Ç¤­¤Þ¤¹¡§

  $mime_header = $j->MIME_Header;
¤³¤Î¾ì¹çCW$mime_header¤ÎÌá¤êÃͤÏMIME-B-encoded UTF-8¤Ë¤Ê¤ê¤Þ¤¹¡£ °ìÊý¡¢CW$j->mime_encode()¤ÏMIME-B-encoded ISO-2022-JP¤òÊÖ¤·¤Þ¤¹¡£ ºÇ¶á¤Î¤Û¤È¤ó¤É¤Î¥á¡¼¥é¡¼¤Ï¤É¤Á¤é¤â¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£
$j->mime_decode;
Jcode¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆâÉôʸ»úÎó¤òMIME-Header¥Ç¥³¡¼¥É¤·¤Þ¤¹¡£Perl 5.8.1 °Ê¹ß¤Ê¤é¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤ÆƱ¤¸¤³¤È¤¬¤Ç¤­¤Þ¤¹¡§
  Jcode->new($str, 'MIME-Header');
¤³¤Á¤é¤Î¾ì¹ç¡¢ISO-2022-JP¤À¤±¤Ç¤Ï¤Ê¤¯UTF-8¤Ê¤É¤Ë¤âÂбþ¤·¤Æ¤ª¤ê¡¢ ¤µ¤é¤ËMIME B Encoding¤Î¤ß¤Ê¤é¤ºMIME Q Encoding¤Ë¤âÂбþ¤·¤Æ¤¤¤ë ¤Î¤Ç¡¢Perl 5.8.1°Ê¹ß¤Ç¤¢¤ì¤Ð¤³¤Á¤é¤ò»È¤¦¤Ù¤­¤Ç¤·¤ç¤¦¡£

Ⱦ³Ñ ¢«¢ª Á´³Ñ

$j->h2z([$keep_dakuten])
X201¥«¥Ê¡ÊȾ³Ñ¡Ë¤òX208¥«¥Ê¡ÊÁ´³Ñ¡Ë¤ËÊÑ´¹¤·¤Þ¤¹¡£ CW$keep_dakuten¤Ë¿¿Ãͤò¥»¥Ã¥È¤¹¤ë¤È¡¢ÂùÅÀ¤ò¤½¤Î¤Þ¤Þ¤Ë¤·¤Þ¤¹ (¤³¤ì¤Ï¤Ä¤Þ¤ê¡¢¡Ö¥«¡Ü¡«¡×¤Ï¡Ö¥¬¡×¤ËÊÑ´¹¤µ¤ì¤º¤Ë¤½¤Î¤Þ¤Þ ¤Ë¤Ê¤ë¤È¤¤¤¦¤³¤È¤Ç¤¹) $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤­¤Þ¤¹¡£
$j->z2h
X208¥«¥Ê¡ÊÁ´³Ñ¡Ë¤òX201¥«¥Ê¡ÊȾ³Ñ¡Ë¤ËÊÑ´¹¤·¤Þ¤¹¡£ $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤­¤Þ¤¹¡£

Àµµ¬É½¸½¥¨¥ß¥å¥ì¡¼¥¿

CW->m()¤ÈCW->s()¤ò»È¤¦¤Ë¤Ï¡¢Perl 5.8.1°Ê¹ß¤¬ ɬÍפǤ¹¡£ Jcode¥ª¥Ö¥¸¥§¥¯¥È¤ËCWtr/$from/$to/¤òŬÍѤ·¤Þ¤¹¡£$from¤È$to¤Ï EUC-JP¤Îʸ»úÎó¤Ç¤¹¡£Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢flagÉÕ¤­¤ÎUTF-8ʸ»úÎó ¤â¼õ¤±ÉÕ¤±¤Þ¤¹¡£ CW$opt¤ò¥»¥Ã¥È¤¹¤ë¤È¡¢CWtr/$from/$to/$opt¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£CW$opt¤Ï 'c'¡¢'d'¤¢¤ë¤¤¤Ï¤½¤ì¤é¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤­¤Þ¤¹¡£ Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢tr¤Î·Á¼°¤Ë¸í¤ê¤Î¤¢¤Ã¤¿¾ì¹ç¤Ë->error_tr¤òÄ̤¸¤Æ¡¢ $@¤ò¼èÆÀ¤Ç¤­¤Þ¤¹¡£ °Ê²¼¤Î¥á¥½¥Ã¥É¤ÏPerl 5.8.1°Ê¹ß¤Ç¤Î¤ßÍøÍѲÄǽ¤Ç¤¹¡£ ¸Ä¡¹¤ËCWs/$pattern/$replace/$opt¤òŬÍѤ·¤Þ¤¹¡£CW$opt¤ÏÀµµ¬É½¸½¥ª¥×¥·¥ç¥ó¤È Ʊ¤¸¤Ç¤¹¡£Àµµ¬É½¸½¤Î¥ª¥×¥·¥ç¥ó¤Ë¤Ä¤¤¤Æ¤Ïperlre¤ò»²¾È¤¯¤À¤µ¤¤¡£ CW$j->tr()¡¢CW$j->s()¤Ï¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¼«¿È¤òÊÖ¤¹¤Î¤Ç¡¢ °Ê²¼¤Î¤è¤¦¤ËÁàºî¤òÏ¢·ë¤Ç¤­¤Þ¤¹¡£

  $j->tr("A-Z", "a-z")->s("foo", "bar");
CWm/$patter/$opt¤òŬÍѤ·¤Þ¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤Ï¡É¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤µ¤Ê¤¤¡É ¤Î¤Ç¡¢CW$j->s()¤Î¤è¤¦¤Ë¥á¥½¥Ã¥É¤òÏ¢·ë¤Ç¤­¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ Àµµ¬É½¸½¤Î·Á¼°¤Ë¸í¤ê¤Î¤¢¤Ã¤¿¾ì¹ç¡¢->error_m¡¢->error_s¤òÄ̤¸¤Æ $@¤ò¼èÆÀ¤Ç¤­¤Þ¤¹¡£

¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô

¤â¤·Jcode¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô¤Ë¥¢¥¯¥»¥¹¤·¤¿¤¤¤Ê¤é¡¢Ä¾Àܤ½¤ì¤é ¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤òÍøÍѤ·¤Þ¤·¤ç¤¦¡Ê¤³¤ì¤¾OOP ¤Ç¤¹¡Ë¡£

»²¹Í¤Þ¤Ç¤Ë¡¢Jcode¤Ï¡Ê°ìÈÌŪ¤ÊÊýË¡¤Ç¤¢¤ë¡Ë¥Ï¥Ã¥·¥å¥ê¥Õ¥¡¥ì¥ó¥¹¤ÎÂå¤ï¤ê¤Ë¡¢ ÇÛÎó¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»È¤¦¤³¤È¤Ç¡¢¥¹¥Ô¡¼¥É¤òºÇŬ²½¤·¤Æ¤¤¤Þ¤¹¡Ê¼ÂºÝ¤Î¤È¤³¤í¡¢ ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ò»È¤¦¸Â¤ê¤³¤Î¤³¤È¤òÃΤëɬÍפϤ¢¤ê¤Þ¤»¤ó¡¨ ¤â¤¦°ìÅÙ ¤¤¤¤¤Þ¤¹¤¬¡¢¤³¤ì¤ÏOOP¤Ê¤Î¤Ç¤¹¡Ë¡£

Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢¥Ï¥Ã¥·¥å¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»È¤¦¤è¤¦¤ËÊѹ¹¤µ¤ì¤Þ¤·¤¿¡£ ¤³¤ì¤Ë¤è¤ê¡¢Jcode¤Î³ÈÄ¥¤Ï¤â¤Î¤¹¤´¤¯´Êñ¤Ë¤Ê¤ê¤Þ¤¹¡£

$j->r_str
EUCʸ»úÎó¤Ø¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¡£ Perl 5.8.1°Ê¹ß¤Ç¤ÏUTF-8¥Õ¥é¥°¤ÎΩ¤Ã¤¿UTF-8ʸ»úÎó¤Ø¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤Ç¤¹¡£
$j->icode
ľ¶á¤ÎÁàºî¤Ë¤ª¤±¤ëÆþÎÏʸ»ú¥³¡¼¥É¡£
$j->nmatch
¥Þ¥Ã¥Á¤·¤¿¿ô¡Ê$j->trÅù¤ò»È¤Ã¤¿¤È¤­¡Ë¡£

¥µ¥Ö¥ë¡¼¥Á¥ó

($code, [$nmatch]) = getcode($str)
$str¤Îʸ»ú¥³¡¼¥É¤òÊÖ¤·¤Þ¤¹¡£Ê֤륳¡¼¥É¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
 ascii   Ascii ¡ÊÆüËܸ쥳¡¼¥É¤ò´Þ¤Þ¤Ê¤¤¡Ë
 binary  Binary ¡Ê¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤Ç¤Ï¤Ê¤¤¡Ë
 euc     EUC-JP
 sjis    SHIFT_JIS
 jis     JIS (ISO-2022-JP)
 ucs2    UCS2 (Raw Unicode)
 utf8    UTF8
¥¹¥«¥é¡¼¥³¥ó¥Æ¥­¥¹¥È¤ÎÂå¤ï¤ê¤ËÇÛÎó¥³¥ó¥Æ¥­¥¹¥È¤ò»È¤¦¤È¡¢²¿Ê¸»úʬ¤Î ¥³¡¼¥É¤¬¸«¤Ä¤«¤Ã¤¿¤Î¤«¤âÊÖ¤·¤Þ¤¹¡£¾å¤ÎÊý¤Ç½Ò¤Ù¤¿¤è¤¦¤Ë¡¢$str¤Ï\$str ¤Ç¤â¹½¤¤¤Þ¤»¤ó¡£ jcode.pl ÍøÍѼԤÎÊý¤Ø¡§ ¤³¤Î´Ø¿ô¤Ïjcode::getcode()¤È100%¾å°Ì¸ß´¹¤¬ ¤¢¤ê¤Þ¤¹¡£¡½¡½¤Þ¤¢¡¢¤Û¤Ü100%¡¨
 * Ìá¤êÃͤ¬ÇÛÎó¤Î¤È¤­¡¢¤½¤Î½çÈ֤ϵդȤʤê¤Þ¤¹¡¨
   jcode::getcode()¤Ï$nmatch¤òºÇ½é¤ËÊÖ¤·¤Þ¤¹¡£
 * jcode::getcode()¤Ï¡¢EUCʸ»ú¤ÈSJISʸ»ú¤Î¿ô¤¬Åù¤·¤¤¤È¤­¡¢'undef'¤ò
   ÊÖ¤·¤Þ¤¹¡£ Jcode::getcode()¤ÏEUC¤òÊÖ¤·¤Þ¤¹¡£¤³¤ì¤ÏJcode.pm¤Ë¤Ï
   Ãæ´Ö¤¬¤Ê¤¤¤¿¤á¤Ç¤¹¡£
$str¤ò$ocode¤Ç»ØÄꤷ¤¿Ê¸»ú¥³¡¼¥É¤ËÊÑ´¹¤·¤Þ¤¹¡£$icode¤â»ØÄꤹ¤ë¤È¡¢ ÆþÎÏʸ»úÎó¤ògetcode()¤Ç¥Á¥§¥Ã¥¯¤¹¤ëÂå¤ï¤ê¤Ë¡¢$icode¤È²¾Äꤷ¤Þ¤¹¡£ ¾å¤ÎÊý¤Ç½Ò¤Ù¤¿¤è¤¦¤Ë¡¢$str¤Ï\$str¤Ç¤â¹½¤¤¤Þ¤»¤ó¡£ jcode.pl ÍøÍѼԤÎÊý¤Ø¡§ ¤³¤Î´Ø¿ô¤Ïjcode::convert()¤È100%¾å°Ì¸ß´¹¤¬ ¤¢¤ê¤Þ¤¹¡ª

¥Ð¥°

Perl¤¬5.8.1°Ê¹ß¤Î¾ì¹ç¡¢Jcode¤ÏEncode¤Î¥é¥Ã¥Ñ¡¼¤È¤·¤Æ¿¶¤ëÉñ¤¤¤Þ¤¹¡£ ¤Ä¤Þ¤ê¡¢Jcode¤ÏEncodeÆâ¤Î¥Ð¥°¤Î±Æ¶Á¤ò¼õ¤±¤Þ¤¹¡£

¼Õ¼­

¤³¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ï¡¢Æ°µ¡¡¢¥Ç¥¶¥¤¥ó¤½¤·¤Æ¥³¡¼¥É¤Î¿¤¯¤ÎÅÀ¤Ç¡¢ ²ÎÂå ÏÂÀµ <utashiro@iij.ad.jp>»á¤ÎPerl4¥é¥¤¥Ö¥é¥êjcode.pl¤ËÉé¤Ã¤Æ¤¤¤Þ¤¹¡£

Âçºê Çî´ð <ohzaki@iod.ricoh.co.jp>»á¤Ï¡¢³«È¯¤ÎÈó¾ï¤Ë½é´ü¤ÎÃʳ¬¤«¤é Àµµ¬É½¸½¤òË᤭¤¢¤²¤ë¼ê½õ¤±¤ò¤·¤Æ¤¯¤ì¤Þ¤·¤¿¡£

makamaka@donzoko.net ¤Î JEncode ¤Ë¤Ï¡¢Jcode¤ÈEncode¤ò¤É¤¦Í»¹ç¤µ¤»¤ì¤Ð ¤¤¤¤¤«ÂçÊÑÂ礭¤Ê·¼¼¨¤ò¼õ¤±¤Þ¤·¤¿¡£¤Þ¤¿¡¢ËÜÆüËܸì¥Þ¥Ë¥å¥¢¥ë¤â´ó£¤·¤Æ ¤¤¤¿¤À¤­¤Þ¤·¤¿¡£

¤½¤·¤ÆJcode ML <jcode5@ring.gr.jp>¤Î³§¤µ¤ó¡£¤³¤ÎÊýã¤Ê¤·¤Ë¤Ï¡¢ ¤³¤³¤Þ¤Ç´°À®¤·¤Ê¤«¤Ã¤¿¤³¤È¤Ç¤·¤ç¤¦¡£

»²¹Í

Encode

<http://www.iana.org/assignments/character-sets>

Ãøºî¸¢

Copyright 1999-2005 Dan Kogai <dankogai@dan.co.jp>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.