Provided by: libjcode-pm-perl_2.06-1_amd64
̾Á°
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¤Ï¤Þ¤À"getcode()"¤È "convert()"¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£ Perl¤Î¥Ð¡¼¥¸¥ç¥ó¤¬5.8.1°Ê¾å¤Ê¤é¡¢Jcode¤Ï¡¢Perl 5.8°Ê¹ß¤Îɸ½àŪ¤Êʸ»ú½¸¹ç ¥Ï¥ó¥É¥é¥â¥¸¥å¡¼¥ë¤Ç¤¢¤ëEncode¤Î¥é¥Ã¥Ñ¡¼¤È¤·¤Æ¿¶¤ëÉñ¤¤¤Þ¤¹¡£
¥á¥½¥Ã¥É
Æä˸ÀµÚ¤·¤Ê¤¤¸Â¤ê¡¢¤³¤³¤Çµó¤²¤ë¥á¥½¥Ã¥É¤ÏÁ´¤ÆJcode¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤·¤Þ¤¹¡£ ¥³¥ó¥¹¥È¥é¥¯¥¿ $j = Jcode->new($str [, $icode]) $str¤«¤éJcode¥ª¥Ö¥¸¥§¥¯¥È$j¤òÀ¸À®¤·¤Þ¤¹¡£ÌÀ¼¨Åª¤Ë$icode¤ò¥»¥Ã¥È¤·¤Ê¤±¤ì¤Ð¡¢ ÆþÎÏ¥³¡¼¥É¤Ï¼«Æ°Åª¤ËȽÄꤵ¤ì¤Þ¤¹¡£ÍøÍѲÄǽ¤Êʸ»ú½¸¹ç¤Ë¤Ä¤¤¤Æ¤Ï¡¢²¼¤Î getcode¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢$icode¤Ë¤ÏEncode¤¬Íý²ò¤Ç¤¤ë ¤É¤ó¤Ê¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾¤â»È¤¨¤Þ¤¹¡£ $j = Jcode->new($european, 'iso-latin1'); ¥ª¥Ö¥¸¥§¥¯¥È¤òʸ»úÎ󲽤¹¤ë¤È¡¢EUC¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤¬ÊÖ¤ê¤Þ¤¹¡£¤Ç¤¹¤«¤é "print $j->euc"¤È¤¹¤ëÂå¤ï¤ê¤Ë¡¢"print $j"¤È¤Ç¤¤Þ¤¹¡£ ¥ê¥Õ¥¡¥ì¥ó¥¹ÅϤ· ¥¹¥«¥é¡¼ÃͤÎÂå¤ï¤ê¤Ë¡¢°Ê²¼¤Î¤è¤¦¤Ë¥ê¥Õ¥¡¥ì¥ó¥¹¤òÅϤ»¤Þ¤¹¡£ Jcode->new(\$str); ¤³¤ì¤Ï¤Û¤ó¤Î¾¯¤·»þ´Ö¤òÀáÌó¤·¤Þ¤¹¡£¤½¤ÎÂå½þ¤È¤·¤Æ¡¢$str¤ÎÃͤ½¤Î¤â¤Î¤¬ ÊÑ´¹¤µ¤ì¤Þ¤¹¡Ê¤¢¤ë°ÕÌ£¡¢$str¤Ïjcode¥ª¥Ö¥¸¥§¥¯¥È¤Ë"tie¤µ¤ì¤ë"¤Î¤Ç¤¹¡Ë¡£ $j->set($str [, $icode]) $j¤ÎÆâÉôʸ»úÎó¤Ë$str¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£·«¤êÊÖ¤·Jcode¥ª¥Ö¥¸¥§¥¯¥È¤ò»È¤¦¤È¤¤Ë ÊØÍø¤Ç¤¹¡Ê¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë»þ´Ö¤È¥á¥â¥ê¤ÎÀáÌó¤Ë¤Ê¤ê¤Þ¤¹¡Ë¡£ # mailbox¤òSJIS·Á¼°¤ËÊÑ´¹ my $jconv = new Jcode; $/ = 00; while(<>){ print $jconv->set(\$_)->mime_decode->sjis; } $j->append($str [, $icode]); $j¤ÎÆâÉôʸ»úÎó¤Ë$str¤ò²Ã¤¨¤Þ¤¹¡£ $j = jcode($str [, $icode]); Jcode->new() ¤Îû½Ì·Á¡£°Ê²¼¤Î¤è¤¦¤Ë¤Ç¤¤Þ¤¹¡¨ $sjis = jcode($str)->sjis; ʸ»úÎó¤Î¥¨¥ó¥³¡¼¥É °ìÈ̤ˡ¢$j->encoded¤È¤¹¤ë¤³¤È¤Çencoded¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤òÆÀ¤Þ¤¹¡£ $sjis = $j->sjis $euc = $j->euc $jis = $j->jis $sjis = $j->sjis $ucs2 = $j->ucs2 $utf8 = $j->utf8 ¼«ÌÀ¤Ç¤·¤ç¤¦¡£ WYCIWYG = What you code is what you get :) $iso_2022_jp = $j->iso_2022_jp "$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¤Î¤â¤Î¤È°ì½ï¤Ç¤¹¡£Êص¹¤Î¤¿¤á¡¢"Jcode::FB_PERLQQ"¡¢ "Jcode::FB_XMLCREF"¡¢"Jcode::FB_HTMLCREF"¤¬Encode¤Î¤½¤ì¤é¤Ø¤Î ¥¨¥¤¥ê¥¢¥¹¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ print $j->fallback(Jcode::FB_PERLQQ)->euc; # '\x{262f}' print $j->fallback(Jcode::FB_XMLCREF)->euc; # '☯' print $j->fallback(Jcode::FB_HTMLCREF)->euc; # '☯' ¥°¥í¡¼¥Ð¥ëÊÑ¿ô$Jcode::FALLBACK¤Ë¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¤¬ÊÝ»ý ¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤³¤ÎÃͤòÂåÆþ¤¹¤ë¤³¤È¤Ç¥ª¡¼¥Ð¡¼¥é¥¤¥É¤Ç¤¤Þ¤¹¡£ $Jcode::FALLBACK = Jcode::FB_PERLQQ; # ¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¥¹¥¡¼¥Þ¤òÀßÄê [@lines =] $jcode->jfold([$width, $newline_str, $kref]) $width¡Ê¥Ç¥Õ¥©¥ë¥È¡§72¡ËËè¤Ëjcodeʸ»úÎóÆâ¤Î¹Ô¤òÀÞ¤êÊÖ¤·¤Þ¤¹¡£ $width¤Ï¡ÉȾ³Ñ¡Éʸ»ú¤Î¿ô¤Ç¤¹¡£Á´³Ñʸ»ú¤Ï2ʸ»ú¤È¤·¤Æ¥«¥¦¥ó¥È¤·¤Þ¤¹¡£ $newline_str¡Ê¥Ç¥Õ¥©¥ë¥È¤Ï"\n"¡Ë¤Ç»ØÄꤵ¤ì¤¿²þ¹Ôʸ»ú¤¬²Ã¤ï¤ê¤Þ¤¹¡£ ÀÞ¤êÊÖ¤µ¤ì¤¿Á´¹Ô¤ò¥ê¥¹¥È¤ÇÊÖ¤·¤Þ¤¹¡£ Perl 5.8.1°Ê¹ß¤Ï3ÈÖÌܤΰú¿ô$kref¤ËEUC¤Îʸ»úÎó¤ÎÇÛÎó¥ê¥Õ¥¡¥ì¥ó¥¹¤ò ÅϤ¹¤³¤È¤Ç¡¢´Ê°×Ū¤Ê¹ÔƬ¶Ø§½èÍý¡Ê¤Ö¤é²¼¤¬¤ê¡Ë¤ò¹Ô¤¨¤Þ¤¹¡£ $length = $jcode->jlength(); ¥Ð¥¤¥ÈĹ¤Ç¤Ï¤Ê¤¯¡¢Á´³Ñʸ»ú¤â°ìʸ»ú¤È¤·¤Æ¿ô¤¨¤¿¾ì¹ç¤Îʸ»ú¿ô¤òÊÖ¤·¤Þ¤¹¡£ MIME::Base64¤ò»È¤¦¥á¥½¥Ã¥É ²¼µ¤Î¥á¥½¥Ã¥É¤ò»È¤¦¤Ë¤Ï¡¢MIME::Base64¤¬É¬ÍפǤ¹¡£¥¤¥ó¥¹¥È¡¼¥ë¤Ïñ½ã¤Ë perl -MCPAN -e 'CPAN::Shell->install("MIME::Base64")' ¤È¤·¤Þ¤¹¡£¤ª»È¤¤¤ÎPerl¤¬5.6°Ê¹ß¤Ç¤¢¤ë¤Ê¤é¡¢MIME::Base64¤Ï ¥Ð¥ó¥É¥ë¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢¥¤¥ó¥¹¥È¡¼¥ë¤ÎɬÍפϤ¢¤ê¤Þ¤»¤ó¡£ $mime_header = $j->mime_encode([$lf, $bpl]) $str¤òRFC1522¤Ë¤¢¤ëMIME-Header¤ËÊÑ´¹¤·¤Þ¤¹¡£$lf¤ò»ØÄꤹ¤ë¤È¡¢ ¹Ô¤ÎÀÞ¤êÊÖ¤·¤Ë$lf¤¬»È¤ï¤ì¤Þ¤¹¡Ê¥Ç¥Õ¥©¥ë¥È¡§\n¡Ë¡£ $bpl¤ò»ØÄꤹ¤ë¤È¡¢ÀÞ¤êÊÖ¤¹¥Ð¥¤¥È¿ô¤Ë$bpl¤¬»È¤ï¤ì¤Þ¤¹¡Ê¥Ç¥Õ¥©¥ë¥È¡§76¡¨ ¤³¤Î¿ôÃͤÏ76°Ê²¼¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡Ë¡£ Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Æ¤âMIME Header¥¨¥ó¥³¡¼¥É¤¬¤Ç¤¤Þ¤¹¡§ $mime_header = $j->MIME_Header; ¤³¤Î¾ì¹ç$mime_header¤ÎÌá¤êÃͤÏMIME-B-encoded UTF-8¤Ë¤Ê¤ê¤Þ¤¹¡£ °ìÊý¡¢"$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¥«¥Ê¡ÊÁ´³Ñ¡Ë¤ËÊÑ´¹¤·¤Þ¤¹¡£ $keep_dakuten¤Ë¿¿Ãͤò¥»¥Ã¥È¤¹¤ë¤È¡¢ÂùÅÀ¤ò¤½¤Î¤Þ¤Þ¤Ë¤·¤Þ¤¹ (¤³¤ì¤Ï¤Ä¤Þ¤ê¡¢¡Ö¥«¡Ü¡«¡×¤Ï¡Ö¥¬¡×¤ËÊÑ´¹¤µ¤ì¤º¤Ë¤½¤Î¤Þ¤Þ ¤Ë¤Ê¤ë¤È¤¤¤¦¤³¤È¤Ç¤¹) $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£ $j->z2h X208¥«¥Ê¡ÊÁ´³Ñ¡Ë¤òX201¥«¥Ê¡ÊȾ³Ñ¡Ë¤ËÊÑ´¹¤·¤Þ¤¹¡£ $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£ Àµµ¬É½¸½¥¨¥ß¥å¥ì¡¼¥¿ "->m()"¤È"->s()"¤ò»È¤¦¤Ë¤Ï¡¢Perl 5.8.1°Ê¹ß¤¬ ɬÍפǤ¹¡£ $j->tr($from, $to, $opt); Jcode¥ª¥Ö¥¸¥§¥¯¥È¤Ë"tr/$from/$to/"¤òŬÍѤ·¤Þ¤¹¡£$from¤È$to¤Ï EUC-JP¤Îʸ»úÎó¤Ç¤¹¡£Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢flagÉÕ¤¤ÎUTF-8ʸ»úÎó ¤â¼õ¤±ÉÕ¤±¤Þ¤¹¡£ $opt¤ò¥»¥Ã¥È¤¹¤ë¤È¡¢"tr/$from/$to/$opt"¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£$opt¤Ï 'c'¡¢'d'¤¢¤ë¤¤¤Ï¤½¤ì¤é¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£ Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢tr¤Î·Á¼°¤Ë¸í¤ê¤Î¤¢¤Ã¤¿¾ì¹ç¤Ë->error_tr¤òÄ̤¸¤Æ¡¢ $@¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£ °Ê²¼¤Î¥á¥½¥Ã¥É¤ÏPerl 5.8.1°Ê¹ß¤Ç¤Î¤ßÍøÍѲÄǽ¤Ç¤¹¡£ $j->s($patter, $replace, $opt); ¸Ä¡¹¤Ë"s/$pattern/$replace/$opt"¤òŬÍѤ·¤Þ¤¹¡£$opt¤ÏÀµµ¬É½¸½¥ª¥×¥·¥ç¥ó¤È Ʊ¤¸¤Ç¤¹¡£Àµµ¬É½¸½¤Î¥ª¥×¥·¥ç¥ó¤Ë¤Ä¤¤¤Æ¤Ïperlre¤ò»²¾È¤¯¤À¤µ¤¤¡£ "$j->tr()"¡¢"$j->s()"¤Ï¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¼«¿È¤òÊÖ¤¹¤Î¤Ç¡¢ °Ê²¼¤Î¤è¤¦¤ËÁàºî¤òÏ¢·ë¤Ç¤¤Þ¤¹¡£ $j->tr("A-Z", "a-z")->s("foo", "bar"); [@match = ] $j->m($pattern, $opt); "m/$patter/$opt"¤òŬÍѤ·¤Þ¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤Ï¡É¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤µ¤Ê¤¤¡É ¤Î¤Ç¡¢"$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¤Ë¤Ï Ãæ´Ö¤¬¤Ê¤¤¤¿¤á¤Ç¤¹¡£ Jcode::convert($str, [$ocode, $icode, $opt]) $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.