1Jcode::Nihongo(3) User Contributed Perl Documentation Jcode::Nihongo(3)
2
3
4
6 Jcode - ÆüËܸìʸ»ú½¸¹ç¥Ï¥ó¥É¥é
7
9 use Jcode;
10 #
11 # ¸Å¼°¤æ¤«¤·¤¯
12 Jcode::convert($str, $ocode, $icode, "z");
13 # ¤â¤·¤¯¤Ï¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¤Ç¡ª
14 print Jcode->new($str)->h2z->tr($from, $to)->utf8;
15
17 Jcode.pm¤Ï¥ª¥Ö¥¸¥§¥¯¥ÈŪ¤Ê¥¢¥×¥í¡¼¥Á¤È½¾Í褫¤é¤Î¥¢¥×¥í¡¼¥Á¤ÎξÊý¤ò
18 ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£¥ª¥Ö¥¸¥§¥¯¥ÈŪ¤Ê¥¢¥×¥í¡¼¥Á¤ò»È¤¨¤Ð¤³¤ó¤Ê´¶¤¸¤Ç¡¨
19
20 $iso_2022_jp = Jcode->new($str)->h2z->jis;
21
22 ¤³¤Á¤é¤è¤ê¥¨¥ì¥¬¥ó¥È¤Ç¤·¤ç¤¦¡§
23
24 $iso_2022_jp = $str;
25 &jcode::convert(\$iso_2022_jp, 'jis', &jcode::getcode(\$str), "z");
26
27 ¥ª¥Ö¥¸¥§¥¯¥È¤ËÆëÀ÷¤ß¤Î̵¤¤¿Í¤Î¤¿¤á¤Ë¡¢Jcode.pm¤Ï¤Þ¤À"getcode()"¤È "con‐
28 vert()"¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£
29
30 Perl¤Î¥Ð¡¼¥¸¥ç¥ó¤¬5.8.1°Ê¾å¤Ê¤é¡¢Jcode¤Ï¡¢Perl
31 5.8°Ê¹ß¤Îɸ½àŪ¤Êʸ»ú½¸¹ç
32 ¥Ï¥ó¥É¥é¥â¥¸¥å¡¼¥ë¤Ç¤¢¤ëEncode¤Î¥é¥Ã¥Ñ¡¼¤È¤·¤Æ¿¶¤ëÉñ¤¤¤Þ¤¹¡£
33
35 Æä˸ÀµÚ¤·¤Ê¤¤¸Â¤ê¡¢¤³¤³¤Çµó¤²¤ë¥á¥½¥Ã¥É¤ÏÁ´¤ÆJcode¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤·¤Þ¤¹¡£
36
37 ¥³¥ó¥¹¥È¥é¥¯¥¿
38
39 $j = Jcode->new($str [, $icode])
40 $str¤«¤éJcode¥ª¥Ö¥¸¥§¥¯¥È$j¤òÀ¸À®¤·¤Þ¤¹¡£ÌÀ¼¨Åª¤Ë$icode¤ò¥»¥Ã¥È¤·¤Ê¤±¤ì¤Ð¡¢
41 ÆþÎÏ¥³¡¼¥É¤Ï¼«Æ°Åª¤ËȽÄꤵ¤ì¤Þ¤¹¡£ÍøÍѲÄǽ¤Êʸ»ú½¸¹ç¤Ë¤Ä¤¤¤Æ¤Ï¡¢²¼¤Î
42 getcode¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
43
44 Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢$icode¤Ë¤ÏEncode¤¬Íý²ò¤Ç¤¤ë
45 ¤É¤ó¤Ê¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾¤â»È¤¨¤Þ¤¹¡£
46
47 $j = Jcode->new($european, 'iso-latin1');
48
49 ¥ª¥Ö¥¸¥§¥¯¥È¤òʸ»úÎ󲽤¹¤ë¤È¡¢EUC¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤¬ÊÖ¤ê¤Þ¤¹¡£¤Ç¤¹¤«¤é
50 "print $j->euc"¤È¤¹¤ëÂå¤ï¤ê¤Ë¡¢"print $j"¤È¤Ç¤¤Þ¤¹¡£
51
52 ¥ê¥Õ¥¡¥ì¥ó¥¹ÅϤ·
53 ¥¹¥«¥é¡¼ÃͤÎÂå¤ï¤ê¤Ë¡¢°Ê²¼¤Î¤è¤¦¤Ë¥ê¥Õ¥¡¥ì¥ó¥¹¤òÅϤ»¤Þ¤¹¡£
54
55 Jcode->new(\$str);
56
57 ¤³¤ì¤Ï¤Û¤ó¤Î¾¯¤·»þ´Ö¤òÀáÌó¤·¤Þ¤¹¡£¤½¤ÎÂå½þ¤È¤·¤Æ¡¢$str¤ÎÃͤ½¤Î¤â¤Î¤¬
58 ÊÑ´¹¤µ¤ì¤Þ¤¹¡Ê¤¢¤ë°ÕÌ£¡¢$str¤Ïjcode¥ª¥Ö¥¸¥§¥¯¥È¤Ë"tie¤µ¤ì¤ë"¤Î¤Ç¤¹¡Ë¡£
59
60 $j->set($str [, $icode])
61 $j¤ÎÆâÉôʸ»úÎó¤Ë$str¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£·«¤êÊÖ¤·Jcode¥ª¥Ö¥¸¥§¥¯¥È¤ò»È¤¦¤È¤‐
62 ¤Ë ÊØÍø¤Ç¤¹¡Ê¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë»þ´Ö¤È¥á¥â¥ê¤ÎÀáÌó¤Ë¤Ê¤ê¤Þ¤¹¡Ë¡£
63
64 # mailbox¤òSJIS·Á¼°¤ËÊÑ´¹
65 my $jconv = new Jcode;
66 $/ = 00;
67 while(<>){
68 print $jconv->set(\$_)->mime_decode->sjis;
69 }
70
71 $j->append($str [, $icode]);
72 $j¤ÎÆâÉôʸ»úÎó¤Ë$str¤ò²Ã¤¨¤Þ¤¹¡£
73
74 $j = jcode($str [, $icode]);
75 Jcode->new() ¤Îû½Ì·Á¡£°Ê²¼¤Î¤è¤¦¤Ë¤Ç¤¤Þ¤¹¡¨
76
77 $sjis = jcode($str)->sjis;
78
79 ʸ»úÎó¤Î¥¨¥ó¥³¡¼¥É
80
81 °ìÈ̤ˡ¢$j->encoded¤È¤¹¤ë¤³¤È¤Çencoded¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤òÆÀ¤Þ¤¹¡£
82
83 $sjis = $j->sjis
84 $euc = $j->euc
85 $jis = $j->jis
86 $sjis = $j->sjis
87 $ucs2 = $j->ucs2
88 $utf8 = $j->utf8
89 ¼«ÌÀ¤Ç¤·¤ç¤¦¡£ WYCIWYG = What you code is what you get :)
90
91 $iso_2022_jp = $j->iso_2022_jp
92 "$j->h2z->jis"¤ÈƱ¤¸¤Ç¤¹¡£ Ⱦ³Ñ¥«¥Ê¤Ï¶¯À©Åª¤ËÁ´³Ñ¤ËÊÑ´¹¤µ¤ì¤Þ¤¹¡£
93
94 Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢Encode¤¬¥µ¥Ý¡¼¥È¤¹¤ë¤É¤ó¤Ê¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾¤È
95 ¥¨¥¤¥ê¥¢¥¹¤Ç¤âÍøÍѤǤ¤Þ¤¹¡£Î㤨¤Ð¡§
96
97 $european = $j->iso_latin1; # ¥á¥½¥Ã¥É̾ÍѤË'-'¤Ï'_'¤ËÃÖ¤´¹¤¨¤Þ¤¹
98
99 »²¹Í¡§Encode::Encoder¤¬¤³¤ì¤ÈƱ¤¸¾®µ»¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£
100
101 $j->fallback($fallback)
102 Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢Jcode¤ÏÆâÉô¤Îʸ»úÎó¤òUTF-8¤ÇÊÝ»ý¤·¤Þ¤¹¡£
103 ->encoding¤Ë¥Þ¥Ã¥×¤Ç¤¤Ê¤¤Ê¸»ú¤Ï'?'¤ËÃÖ¤´¹¤¨¤é¤ì¤Þ¤¹¤¬¡¢
104 ¤³¤ì¤ÏEncode¤Ç¤Îɸ½àÆ°ºî¤Ç¤¹¡£
105
106 my $unistr = "\x{262f}"; # ±¢ÍÛ¥Þ¡¼¥¯
107 my $j = jcode($unistr); # $j->euc ¤Î·ë²Ì¤Ï '?' ¤Ë
108
109 ¤³¤Î¿¶¤ëÉñ¤¤¤Ï¡¢EncodeƱÍÍ¡¢¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¤ò»ØÄꤹ¤ë¤³¤È¤ÇÊѹ¹¤Ç¤‐
110 ¤Þ¤¹¡£ ÃͤÏEncode¤Î¤â¤Î¤È°ì½ï¤Ç¤¹¡£Êص¹¤Î¤¿¤á¡¢"Jcode::FB_PERLQQ"¡¢
111 "Jcode::FB_XMLCREF"¡¢"Jcode::FB_HTMLCREF"¤¬Encode¤Î¤½¤ì¤é¤Ø¤Î
112 ¥¨¥¤¥ê¥¢¥¹¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
113
114 print $j->fallback(Jcode::FB_PERLQQ)->euc; # '\x{262f}'
115 print $j->fallback(Jcode::FB_XMLCREF)->euc; # '☯'
116 print $j->fallback(Jcode::FB_HTMLCREF)->euc; # '☯'
117
118 ¥°¥í¡¼¥Ð¥ëÊÑ¿ô$Jcode::FALLBACK¤Ë¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¤¬ÊÝ»ý
119 ¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤³¤ÎÃͤòÂåÆþ¤¹¤ë¤³¤È¤Ç¥ª¡¼¥Ð¡¼¥é¥¤¥É¤Ç¤¤Þ¤¹¡£
120
121 $Jcode::FALLBACK = Jcode::FB_PERLQQ; # ¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥©¡¼¥ë¥Ð¥Ã¥¯¥¹¥¡¼¥Þ¤òÀßÄê
122
123 [@lines =] $jcode->jfold([$width, $newline_str, $kref])
124 $width¡Ê¥Ç¥Õ¥©¥ë¥È¡§72¡ËËè¤Ëjcodeʸ»úÎóÆâ¤Î¹Ô¤òÀÞ¤êÊÖ¤·¤Þ¤¹¡£
125 $width¤Ï¡ÉȾ³Ñ¡Éʸ»ú¤Î¿ô¤Ç¤¹¡£Á´³Ñʸ»ú¤Ï2ʸ»ú¤È¤·¤Æ¥«¥¦¥ó¥È¤·¤Þ¤¹¡£
126
127 $newline_str¡Ê¥Ç¥Õ¥©¥ë¥È¤Ï"\n"¡Ë¤Ç»ØÄꤵ¤ì¤¿²þ¹Ôʸ»ú¤¬²Ã¤ï¤ê¤Þ¤¹¡£
128 ÀÞ¤êÊÖ¤µ¤ì¤¿Á´¹Ô¤ò¥ê¥¹¥È¤ÇÊÖ¤·¤Þ¤¹¡£
129
130 Perl 5.8.1°Ê¹ß¤Ï3ÈÖÌܤΰú¿ô$kref¤ËEUC¤Îʸ»úÎó¤ÎÇÛÎó¥ê¥Õ¥¡¥ì¥ó¥¹¤ò
131 ÅϤ¹¤³¤È¤Ç¡¢´Ê°×Ū¤Ê¹ÔƬ¶Ø§½èÍý¡Ê¤Ö¤é²¼¤¬¤ê¡Ë¤ò¹Ô¤¨¤Þ¤¹¡£
132
133 $length = $jcode->jlength();
134 ¥Ð¥¤¥ÈĹ¤Ç¤Ï¤Ê¤¯¡¢Á´³Ñʸ»ú¤â°ìʸ»ú¤È¤·¤Æ¿ô¤¨¤¿¾ì¹ç¤Îʸ»ú¿ô¤òÊÖ¤·¤Þ¤¹¡£
135
136 MIME::Base64¤ò»È¤¦¥á¥½¥Ã¥É
137
138 ²¼µ¤Î¥á¥½¥Ã¥É¤ò»È¤¦¤Ë¤Ï¡¢MIME::Base64¤¬É¬ÍפǤ¹¡£¥¤¥ó¥¹¥È¡¼¥ë¤Ïñ½ã¤Ë
139
140 perl -MCPAN -e 'CPAN::Shell->install("MIME::Base64")'
141
142 ¤È¤·¤Þ¤¹¡£¤ª»È¤¤¤ÎPerl¤¬5.6°Ê¹ß¤Ç¤¢¤ë¤Ê¤é¡¢MIME::Base64¤Ï
143 ¥Ð¥ó¥É¥ë¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢¥¤¥ó¥¹¥È¡¼¥ë¤ÎɬÍפϤ¢¤ê¤Þ¤»¤ó¡£
144
145 $mime_header = $j->mime_encode([$lf, $bpl])
146 $str¤òRFC1522¤Ë¤¢¤ëMIME-Header¤ËÊÑ´¹¤·¤Þ¤¹¡£$lf¤ò»ØÄꤹ¤ë¤È¡¢
147 ¹Ô¤ÎÀÞ¤êÊÖ¤·¤Ë$lf¤¬»È¤ï¤ì¤Þ¤¹¡Ê¥Ç¥Õ¥©¥ë¥È¡§\n¡Ë¡£
148 $bpl¤ò»ØÄꤹ¤ë¤È¡¢ÀÞ¤êÊÖ¤¹¥Ð¥¤¥È¿ô¤Ë$bpl¤¬»È¤ï¤ì¤Þ¤¹¡Ê¥Ç¥Õ¥©¥ë¥È¡§76¡¨
149 ¤³¤Î¿ôÃͤÏ76°Ê²¼¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡Ë¡£
150
151 Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Æ¤âMIME Header¥¨¥ó¥³¡¼¥É¤¬¤Ç¤‐
152 ¤Þ¤¹¡§
153
154 $mime_header = $j->MIME_Header;
155
156 ¤³¤Î¾ì¹ç$mime_header¤ÎÌá¤êÃͤÏMIME-B-encoded UTF-8¤Ë¤Ê¤ê¤Þ¤¹¡£
157 °ìÊý¡¢"$j->mime_encode()"¤ÏMIME-B-encoded ISO-2022-JP¤òÊÖ¤·¤Þ¤¹¡£
158 ºÇ¶á¤Î¤Û¤È¤ó¤É¤Î¥á¡¼¥é¡¼¤Ï¤É¤Á¤é¤â¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£
159
160 $j->mime_decode;
161 Jcode¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆâÉôʸ»úÎó¤òMIME-Header¥Ç¥³¡¼¥É¤·¤Þ¤¹¡£Perl 5.8.1
162 °Ê¹ß¤Ê¤é¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤ÆƱ¤¸¤³¤È¤¬¤Ç¤¤Þ¤¹¡§
163
164 Jcode->new($str, 'MIME-Header');
165
166 ¤³¤Á¤é¤Î¾ì¹ç¡¢ISO-2022-JP¤À¤±¤Ç¤Ï¤Ê¤¯UTF-8¤Ê¤É¤Ë¤âÂбþ¤·¤Æ¤ª¤ê¡¢
167 ¤µ¤é¤ËMIME B Encoding¤Î¤ß¤Ê¤é¤ºMIME Q Encoding¤Ë¤âÂбþ¤·¤Æ¤¤¤ë
168 ¤Î¤Ç¡¢Perl 5.8.1°Ê¹ß¤Ç¤¢¤ì¤Ð¤³¤Á¤é¤ò»È¤¦¤Ù¤¤Ç¤·¤ç¤¦¡£
169
170 Ⱦ³Ñ ¢«¢ª Á´³Ñ
171
172 $j->h2z([$keep_dakuten])
173 X201¥«¥Ê¡ÊȾ³Ñ¡Ë¤òX208¥«¥Ê¡ÊÁ´³Ñ¡Ë¤ËÊÑ´¹¤·¤Þ¤¹¡£
174 $keep_dakuten¤Ë¿¿Ãͤò¥»¥Ã¥È¤¹¤ë¤È¡¢ÂùÅÀ¤ò¤½¤Î¤Þ¤Þ¤Ë¤·¤Þ¤¹
175 (¤³¤ì¤Ï¤Ä¤Þ¤ê¡¢¡Ö¥«¡Ü¡«¡×¤Ï¡Ö¥¬¡×¤ËÊÑ´¹¤µ¤ì¤º¤Ë¤½¤Î¤Þ¤Þ
176 ¤Ë¤Ê¤ë¤È¤¤¤¦¤³¤È¤Ç¤¹)
177
178 $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£
179
180 $j->z2h
181 X208¥«¥Ê¡ÊÁ´³Ñ¡Ë¤òX201¥«¥Ê¡ÊȾ³Ñ¡Ë¤ËÊÑ´¹¤·¤Þ¤¹¡£
182
183 $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£
184
185 Àµµ¬É½¸½¥¨¥ß¥å¥ì¡¼¥¿
186
187 "->m()"¤È"->s()"¤ò»È¤¦¤Ë¤Ï¡¢Perl 5.8.1°Ê¹ß¤¬ ɬÍפǤ¹¡£
188
189 $j->tr($from, $to, $opt);
190 Jcode¥ª¥Ö¥¸¥§¥¯¥È¤Ë"tr/$from/$to/"¤òŬÍѤ·¤Þ¤¹¡£$from¤È$to¤Ï
191 EUC-JP¤Îʸ»úÎó¤Ç¤¹¡£Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢flagÉÕ¤¤ÎUTF-8ʸ»úÎó
192 ¤â¼õ¤±ÉÕ¤±¤Þ¤¹¡£
193
194 $opt¤ò¥»¥Ã¥È¤¹¤ë¤È¡¢"tr/$from/$to/$opt"¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£$opt¤Ï
195 'c'¡¢'d'¤¢¤ë¤¤¤Ï¤½¤ì¤é¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
196
197 $j->nmatch¤òÄ̤¸¤Æ¥Þ¥Ã¥Á¤·¤¿¿ô¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£
198
199 Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢tr¤Î·Á¼°¤Ë¸í¤ê¤Î¤¢¤Ã¤¿¾ì¹ç¤Ë->error_tr¤òÄ̤¸¤Æ¡¢
200 $@¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£
201
202 °Ê²¼¤Î¥á¥½¥Ã¥É¤ÏPerl 5.8.1°Ê¹ß¤Ç¤Î¤ßÍøÍѲÄǽ¤Ç¤¹¡£
203
204 $j->s($patter, $replace, $opt);
205 ¸Ä¡¹¤Ë"s/$pat‐
206 tern/$replace/$opt"¤òŬÍѤ·¤Þ¤¹¡£$opt¤ÏÀµµ¬É½¸½¥ª¥×¥·¥ç¥ó¤È
207 Ʊ¤¸¤Ç¤¹¡£Àµµ¬É½¸½¤Î¥ª¥×¥·¥ç¥ó¤Ë¤Ä¤¤¤Æ¤Ïperlre¤ò»²¾È¤¯¤À¤µ¤¤¡£
208
209 "$j->tr()"¡¢"$j->s()"¤Ï¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¼«¿È¤òÊÖ¤¹¤Î¤Ç¡¢
210 °Ê²¼¤Î¤è¤¦¤ËÁàºî¤òÏ¢·ë¤Ç¤¤Þ¤¹¡£
211
212 $j->tr("A-Z", "a-z")->s("foo", "bar");
213
214 [@match = ] $j->m($pattern, $opt);
215 "m/$pat‐
216 ter/$opt"¤òŬÍѤ·¤Þ¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤Ï¡É¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤µ¤Ê¤¤¡É
217 ¤Î¤Ç¡¢"$j->s()"¤Î¤è¤¦¤Ë¥á¥½¥Ã¥É¤òÏ¢·ë¤Ç¤¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
218
219 Àµµ¬É½¸½¤Î·Á¼°¤Ë¸í¤ê¤Î¤¢¤Ã¤¿¾ì¹ç¡¢->error_m¡¢->error_s¤òÄ̤¸¤Æ
220 $@¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£
221
222 ¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô
223
224 ¤â¤·Jcode¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¤¥ó¥¹¥¿¥ó¥¹ÊÑ¿ô¤Ë¥¢¥¯¥»¥¹¤·¤¿¤¤¤Ê¤é¡¢Ä¾Àܤ½¤ì¤é
225 ¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤òÍøÍѤ·¤Þ¤·¤ç¤¦¡Ê¤³¤ì¤¾OOP
226 ¤Ç¤¹¡Ë¡£
227
228 »²¹Í¤Þ¤Ç¤Ë¡¢Jcode¤Ï¡Ê°ìÈÌŪ¤ÊÊýË¡¤Ç¤¢¤ë¡Ë¥Ï¥Ã¥·¥å¥ê¥Õ¥¡¥ì¥ó¥¹¤ÎÂå¤ï¤ê¤Ë¡¢
229 ÇÛÎó¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»È¤¦¤³¤È¤Ç¡¢¥¹¥Ô¡¼¥É¤òºÇŬ²½¤·¤Æ¤¤¤Þ¤¹¡Ê¼ÂºÝ¤Î¤È¤³¤í¡¢
230 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ò»È¤¦¸Â¤ê¤³¤Î¤³¤È¤òÃΤëɬÍפϤ¢¤ê¤Þ¤»¤ó¡¨ ¤â¤¦°ìÅÙ
231 ¤¤¤¤¤Þ¤¹¤¬¡¢¤³¤ì¤ÏOOP¤Ê¤Î¤Ç¤¹¡Ë¡£
232
233 Perl 5.8.1°Ê¹ß¤Ç¤Ï¡¢¥Ï¥Ã¥·¥å¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»È¤¦¤è¤¦¤ËÊѹ¹¤µ¤ì¤Þ¤·¤¿¡£
234 ¤³¤ì¤Ë¤è¤ê¡¢Jcode¤Î³ÈÄ¥¤Ï¤â¤Î¤¹¤´¤¯´Êñ¤Ë¤Ê¤ê¤Þ¤¹¡£
235
236 $j->r_str
237 EUCʸ»úÎó¤Ø¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¡£
238
239 Perl
240 5.8.1°Ê¹ß¤Ç¤ÏUTF-8¥Õ¥é¥°¤ÎΩ¤Ã¤¿UTF-8ʸ»úÎó¤Ø¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤Ç¤¹¡£
241
242 $j->icode
243 ľ¶á¤ÎÁàºî¤Ë¤ª¤±¤ëÆþÎÏʸ»ú¥³¡¼¥É¡£
244
245 $j->nmatch
246 ¥Þ¥Ã¥Á¤·¤¿¿ô¡Ê$j->trÅù¤ò»È¤Ã¤¿¤È¤¡Ë¡£
247
249 ($code, [$nmatch]) = getcode($str)
250 $str¤Îʸ»ú¥³¡¼¥É¤òÊÖ¤·¤Þ¤¹¡£Ê֤륳¡¼¥É¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
251
252 ascii Ascii ¡ÊÆüËܸ쥳¡¼¥É¤ò´Þ¤Þ¤Ê¤¤¡Ë
253 binary Binary ¡Ê¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤Ç¤Ï¤Ê¤¤¡Ë
254 euc EUC-JP
255 sjis SHIFT_JIS
256 jis JIS (ISO-2022-JP)
257 ucs2 UCS2 (Raw Unicode)
258 utf8 UTF8
259
260 ¥¹¥«¥é¡¼¥³¥ó¥Æ¥¥¹¥È¤ÎÂå¤ï¤ê¤ËÇÛÎó¥³¥ó¥Æ¥¥¹¥È¤ò»È¤¦¤È¡¢²¿Ê¸»úʬ¤Î
261 ¥³¡¼¥É¤¬¸«¤Ä¤«¤Ã¤¿¤Î¤«¤âÊÖ¤·¤Þ¤¹¡£¾å¤ÎÊý¤Ç½Ò¤Ù¤¿¤è¤¦¤Ë¡¢$str¤Ï\$str
262 ¤Ç¤â¹½¤¤¤Þ¤»¤ó¡£
263
264 jcode.pl ÍøÍѼԤÎÊý¤Ø¡§ ¤³¤Î´Ø¿ô¤Ïjcode::getcode()¤È100%¾å°Ì¸ß´¹¤¬
265 ¤¢¤ê¤Þ¤¹¡£¡½¡½¤Þ¤¢¡¢¤Û¤Ü100%¡¨
266
267 * Ìá¤êÃͤ¬ÇÛÎó¤Î¤È¤¡¢¤½¤Î½çÈ֤ϵդȤʤê¤Þ¤¹¡¨
268 jcode::getcode()¤Ï$nmatch¤òºÇ½é¤ËÊÖ¤·¤Þ¤¹¡£
269
270 * jcode::getcode()¤Ï¡¢EUCʸ»ú¤ÈSJISʸ»ú¤Î¿ô¤¬Åù¤·¤¤¤È¤¡¢'undef'¤ò
271 ÊÖ¤·¤Þ¤¹¡£ Jcode::getcode()¤ÏEUC¤òÊÖ¤·¤Þ¤¹¡£¤³¤ì¤ÏJcode.pm¤Ë¤Ï
272 Ãæ´Ö¤¬¤Ê¤¤¤¿¤á¤Ç¤¹¡£
273
274 Jcode::convert($str, [$ocode, $icode, $opt])
275 $str¤ò$ocode¤Ç»ØÄꤷ¤¿Ê¸»ú¥³¡¼¥É¤ËÊÑ´¹¤·¤Þ¤¹¡£$icode¤â»ØÄꤹ¤ë¤È¡¢
276 ÆþÎÏʸ»úÎó¤ògetcode()¤Ç¥Á¥§¥Ã¥¯¤¹¤ëÂå¤ï¤ê¤Ë¡¢$icode¤È²¾Äꤷ¤Þ¤¹¡£
277 ¾å¤ÎÊý¤Ç½Ò¤Ù¤¿¤è¤¦¤Ë¡¢$str¤Ï\$str¤Ç¤â¹½¤¤¤Þ¤»¤ó¡£
278
279 jcode.pl ÍøÍѼԤÎÊý¤Ø¡§ ¤³¤Î´Ø¿ô¤Ïjcode::convert()¤È100%¾å°Ì¸ß´¹¤¬
280 ¤¢¤ê¤Þ¤¹¡ª
281
283 Perl¤¬5.8.1°Ê¹ß¤Î¾ì¹ç¡¢Jcode¤ÏEncode¤Î¥é¥Ã¥Ñ¡¼¤È¤·¤Æ¿¶¤ëÉñ¤¤¤Þ¤¹¡£
284 ¤Ä¤Þ¤ê¡¢Jcode¤ÏEncodeÆâ¤Î¥Ð¥°¤Î±Æ¶Á¤ò¼õ¤±¤Þ¤¹¡£
285
287 ¤³¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ï¡¢Æ°µ¡¡¢¥Ç¥¶¥¤¥ó¤½¤·¤Æ¥³¡¼¥É¤Î¿¤¯¤ÎÅÀ¤Ç¡¢ ²ÎÂå ÏÂÀµ
288 <utashiro@iij.ad.jp>»á¤ÎPerl4¥é¥¤¥Ö¥é¥êjcode.pl¤ËÉé¤Ã¤Æ¤¤¤Þ¤¹¡£
289
290 Âçºê Çî´ð <ohzaki@iod.ricoh.co.jp>»á¤Ï¡¢³«È¯¤ÎÈó¾ï¤Ë½é´ü¤ÎÃʳ¬¤«¤é
291 Àµµ¬É½¸½¤òËᤤ¢¤²¤ë¼ê½õ¤±¤ò¤·¤Æ¤¯¤ì¤Þ¤·¤¿¡£
292
293 makamaka@donzoko.net ¤Î JEncode ¤Ë¤Ï¡¢Jcode¤ÈEncode¤ò¤É¤¦Í»¹ç¤µ¤»¤ì¤Ð
294 ¤¤¤¤¤«ÂçÊÑÂ礤ʷ¼¼¨¤ò¼õ¤±¤Þ¤·¤¿¡£¤Þ¤¿¡¢ËÜÆüËܸì¥Þ¥Ë¥å¥¢¥ë¤â´ó£¤·¤Æ
295 ¤¤¤¿¤À¤¤Þ¤·¤¿¡£
296
297 ¤½¤·¤ÆJcode ML <jcode5@ring.gr.jp>¤Î³§¤µ¤ó¡£¤³¤ÎÊýã¤Ê¤·¤Ë¤Ï¡¢
298 ¤³¤³¤Þ¤Ç´°À®¤·¤Ê¤«¤Ã¤¿¤³¤È¤Ç¤·¤ç¤¦¡£
299
301 Encode
302
303 <http://www.iana.org/assignments/character-sets>
304
306 Copyright 1999-2005 Dan Kogai <dankogai@dan.co.jp>
307
308 This library is free software; you can redistribute it and/or modify it
309 under the same terms as Perl itself.
310
311
312
313perl v5.8.8 2005-02-19 Jcode::Nihongo(3)