åå‰ Jcode::CP932 - CP932æº–æ‹ ã«ã‚ˆã‚‹Jcode æ¦‚è¦ use Jcode::CP932; # 推奨(Jcode.pmã¨ã®äº’æ›ã‚’考ãˆã¦ï¼‰ jcode( $str )->utf8; # å¤å¼ã‚†ã‹ã—ã Jcode::CP932::convert($str, $ocode, $icode, "z"); # ã‚‚ã—ãã¯ã‚ªãƒ–ジェクト指å‘ã§ï¼ print Jcode::CP932->new($str)->h2z->tr($from, $to)->utf8; 説明 Jcode::CP932ã¯CP932ã«ã‚ˆã‚‹Unicodeマッピングを用ã„ãŸJcode代替物ã§ã™ã€‚ sjisã¯CP932ã®ã€eucã‚„jisã¯CP51932ãŠã‚ˆã³CP50221ã®ãƒžãƒƒãƒ”ングを利用ã—ã¦ã„ã¾ã™ã€‚ 特ã«èª¬æ˜Žã®ãªã„点ã¯Jcodeã¨åŒæ§˜ã®å‹•ä½œã«ãªã‚Šã¾ã™ã€‚ æ£è¦åŒ– JISç³»ã§å¤‰æ›ã—ãŸUTF-8æ–‡å—ã¨CP932ç³»ã§å¤‰æ›ã—ãŸUTF-8ã§ã®ä¸æ•´åˆã‚’解消ã™ã‚‹ãŸã‚ã«ã€ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‰å¤‰æ›æ™‚ã«æ£è¦åŒ–処ç†ã‚’è¡Œãªã†ã“ã¨ãŒã§ãã¾ã™ 。 標準ã§ã¯ä¸€éƒ¨è¨˜å·ã‚’JISç³»ã®ã‚‚ã®ã‹ã‚‰CP932ç³»ã«å¤‰æ›ã—ã¦ã„ã¾ã™ã€‚ è¿½åŠ ãƒ¡ã‚½ãƒƒãƒ‰ オリジナルã®Jcodeã«å¯¾ã—ã¦ã€ä»¥ä¸‹ã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’è¿½åŠ ã—ã¦ã„ã¾ã™ã€‚ (ã“れらã¯ä¸»ã«Unicode::Japaneseã‚’å‚考ã«ã—ã¾ã—ãŸï¼‰ get Jcode内部ã«ä¿å˜ã—ã¦ã„ã‚‹UTF-8æ–‡å—列をå–å¾—ã—ã¾ã™ã€‚ utf8メソッドã§ã¯UTF-8æ–‡å—列をãƒã‚¤ãƒŠãƒªã«å¤‰æ›ã—ã¾ã™ãŒã€getメソッドã§ã¯utf8フラグãŒä»˜ã„ãŸæ–‡å—列ã«ãªã‚Šã¾ã™ã€‚ ã²ã‚‰ãŒãªã‚«ã‚¿ã‚«ãƒŠå¤‰æ› (hira2kata kata2hira) hira2kataメソッドã¯ã€æ–‡å—列ã«å«ã¾ã‚Œã¦ã„ã‚‹ã²ã‚‰ãŒãªã‚’å…¨ã¦ã‚«ã‚¿ã‚«ãƒŠã«å¤‰æ›ã—ã¾ã™ã€‚ kata2hiraメソッドã¯ã€æ–‡å—列ã«å«ã¾ã‚Œã¦ã„るカタカナを全ã¦ã²ã‚‰ãŒãªã«å¤‰æ›ã—ã¾ã™ã€‚ ASCIIæ–‡å—列ã®å…¨è§’åŠè§’å¤‰æ› z2h_asciiメソッドã¯ã€æ–‡å—列ã«å«ã¾ã‚Œã¦ã„ã‚‹åŠè§’ASCIIを全角ASCIIã«å¤‰æ›ã—ã¾ã™ã€‚ z2h_allメソッドã¯ã€æ–‡å—列ã«å«ã¾ã‚Œã‚‹åŠè§’ã®ASCIIãŠã‚ˆã³ã‚«ã‚¿ã‚«ãƒŠã‚’全角ã«å¤‰æ›ã—ã¾ã™ã€‚ h2z_asciiメソッドã¯ã€æ–‡å—列ã«å«ã¾ã‚Œã¦ã„る全角ASCIIã‚’åŠè§’ASCIIã«å¤‰æ›ã—ã¾ã™ã€‚ z2h_allメソッドã¯ã€æ–‡å—列ã«å«ã¾ã‚Œã‚‹å…¨è§’ã®ASCIIãŠã‚ˆã³ã‚«ã‚¿ã‚«ãƒŠã‚’åŠè§’ã«å¤‰æ›ã—ã¾ã™ã€‚ è¬è¾ž Jcode.pmã®å°é£¼å¼¾æ°ã¨ã€Encode::EUCJPMSã®æˆç€¬ã‚†ã„æ°ã€Unicode::Japaneseã®å±±ç§‘æ°·éšæ°ã«ã€‚ ã¾ãŸã€ãƒ¬ã‚¬ã‚·ãƒ¼ã‚¨ãƒ³ã‚³ãƒ‡ã‚£ãƒ³ã‚°ã®ä»¶ã§ã¯æ£®å±±å°†ä¹‹æ°ã«ãŠä¸–話ã«ãªã‚Šã¾ã—ãŸã€‚ å‚考 Jcode Encode::EUCJPMS Unicode::Japanese 著作権 Copyright 2006-2009 ASAKURA Takuji This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.