̾Á°

Unicode::MapUTF8 - Ǥ°Õ¤Îʸ»ú¥»¥Ã¥È¤«¤é¡¿¤Ø¤ÎUTF8¤ÎÊÑ´¹

³µÍ×

use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset);

# 'ISO-8859-1'¤Îʸ»úÎó¤ò 'UTF8'¤ËÊÑ´¹¤¹¤ë
my $output = to_utf8({ -string => 'An example', -charset => 'ISO-8859-1' });

# 'UTF8'¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Îʸ»úÎó¤ò¥¨¥ó¥³¡¼¥Ç¥£¥ó¥° 'ISO-8859-1'¤ØÊÑ´¹¤¹¤ë
my $other  = from_utf8({ -string => 'Other text', -charset => 'ISO-8859-1' });

# ÍøÍѤǤ­¤ëʸ»ú¥»¥Ã¥È¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î¥ê¥¹¥È
my @character_sets = utf8_supported_charset;

# ʸ»ú¥»¥Ã¥ÈÊÌ̾¤ÎÄɲÃ
utf8_charset_alias({ 'ms-japanese' => 'sjis' });

# £²¤Ä¤ÎǤ°Õ¤Î¡Ê¤·¤«¤·Â礭¤¯¸ß´¹À­¤Î¤¢¤ë¡Ëʸ»ú¥»¥Ã¥È¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ç¤ÎÊÑ´¹
# (SJIS to EUC-JP)
my $utf8_string   = to_utf8({ -string =>$sjis_string, -charset => 'sjis'});
my $euc_jp_string = from_utf8({ -string => $utf8_string, -charset => 'euc-jp' })

# ÆÃÄê¤Îʸ»ú¥»¥Ã¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«¤ò³Îǧ
if (utf8_supported_charset('ISO-8859-1') {
    # Yes
}

ÀâÌÀ

UTF8¤È¤½¤Î¾¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤«¤é¡¿¤Ø¤ÎÊÑ´¹¤Î¤¿¤á¤ÎÃæ³Ë¤È¤Ê¤ë¥ë¡¼¥Á¥ó¤Î´Ö¤Î¥¢¥À¥×¥¿ÁؤòÄ󶡤·¤Þ¤¹¡£ËܼÁŪ¤Ë¤Ï¡¢Ê£¿ô¸ºß¤¹¤ë Unicode¥â¥¸¥å¡¼¥ë¤Ø¤Î£±¤Ä¤Î¶¦Ä̤Υ¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¡¢²¼Éߤ­¤Ë¤Ê¤Ã¤Æ¤¤¤ë¼ÂÁõ¤òÃΤ뤳¤È¤Ê¤¯¡¢´Êñ¤ËUTF8¤«¤é¡¿¤Ø¾¤Îʸ»ú¥»¥Ã¥È¥¨¥ó¥³¡¼¥Ç¥£ ¥ó¥°ÊÑ´¹¤ò´Êñ¤Ë¤ª¤³¤Ê¤¤¤Þ¤¹¡£¤½¤Î¤¿¤á¡¢¤³¤ì¤ÏUnicode::String¡¢Unicode::Map8¡¢Unicode::Map¡¢Jcode¥â ¥¸¥å¡¼¥ë¤òɸ½à²½¤µ¤ì¤¿´Êñ¤ÊAPI¤ÎÃæ¤ËÊñ¤ß¤Þ¤¹¡£

¤Þ¤¿¤³¤ì¤ÏUTF-8¤ò¥Ù¡¼¥¹¤Ë°ìÈÌŪ¤Êʸ»ú¥»¥Ã¥ÈÊÑ´¹¤âÄ󶡤·¤Þ¤¹¡Ý¤³¤ì¤Ï£²Ãʳ¬¤ÎÊÑ´¹¤Ä¤Ê¤²¤ë¤³¤È¤Ë¤è¤ê¡¢£²¤Ä¤Î¸ß´¹À­¤¬¤¢¤ê¡¢¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ëʸ»ú¥»¥Ã¥È¤Ç²Äǽ¤Ç¤¹¡£

¤Û¤È¤ó¤É¤Î¤³¤È¤¬PerlŪ¤Ê¤Î¤Ç¡Ý¤«¤ßºÕ¤¯ÂоݤȤ·¤Æ¿ô¿¤¯¤Î¾®¤µ¤¤¤Ê¤â¤Î¤ÎÂå¤ï¤ê¤Ë£²¡¢£³¤ÎÂ礭¤Ê¸Ç¤Þ¤ê¤òÍ¿¤¨¤ë¤È¡¢1Éô֤ˤè¤ê¿¤¯¤Îʸ»ú¤ò°·¤¤¤Þ¤¹¡£

À߷פǤϡ¢Åо줹¤ë¤¤¤«¤Ê¤ë¿·¤·¤¤Ê¸»ú¥»¥Ã¥È¡¦¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ´¹¥â¥¸¥å¡¼¥ë¤â¼è¤ê¹þ¤à¤è¤¦¤Ë´Êñ¤Ë³ÈÄ¥¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

Êѹ¹ÅÀ

¡Ê¸¶Ê¸¤Î¤Þ¤Þ¡Ë

1.11 2005.10.10   Documentation changes. Addition of Build.PL support.
                  Added various build tests, LICENSE, Artistic_License.txt,
                  GPL_License.txt. Split documentation into seperate
                  .pod file. Added Japanese translation of POD.

1.10 2005.05.22 - Fixed bug in conversion of ISO-2022-JP to UTF-8.
                  Problem and fix found by Masahiro HONMA
                  <masahiro.honma@tsutaya.co.jp>.

                  Similar bugs in conversions of shift_jis and euc-jp
                  to UTF-8 fixed as well.
                 
1.09 2001.08.22 - Fixed multiple typo occurances of 'uft'
                  where 'utf' was meant in code. Problem affected
                  utf16 and utf7 encodings. Problem found
                  by devon smith <devon@taller.PSCL.cwru.edu>

1.08 2000.11.06 - Added 'utf8_charset_alias' function to
                  allow for runtime setting of character
                  set aliases. Added several alternate
                  names for 'sjis' (shiftjis, shift-jis,
                  shift_jis, s-jis, and s_jis).

                  Corrected 'croak' messages for
                  'from_utf8' functions to appropriate
                  function name.

                  Tightened up initialization encapsulation

                  Corrected fatal problem in jcode from
                  unicode internals. Problem and fix
                  found by Brian Wisti <wbrian2@uswest.net>.

1.07 2000.11.01 - Added 'croak' to use Carp declaration to
                  fix error messages.  Problem and fix
                  found by Brian Wisti
                  <wbrian2@uswest.net>.

1.06 2000.10.30 - Fix to handle change in stringification
                  of overloaded objects between Perl 5.005
                  and 5.6. Problem noticed by Brian Wisti
                  <wbrian2@uswest.net>.

1.05 2000.10.23 - Error in conversions from UTF8 to
                  multibyte encodings corrected

1.04 2000.10.23 - Additional diagnostic messages added
                  for internal error conditions

1.03 2000.10.22 - Bug fix for load time autodetction of
                  Unicode::Map8 encodings

1.02 2000.10.22 - Added load time autodetection of
                  Unicode::Map8 supported character set
                  encodings.

                  Fixed internal calling error for some
                  character sets with 'from_utf8'. Thanks
                  goes to Ilia Lobsanov
                  <ilia@lobsanov.com> for reporting this
                  problem.

1.01 2000.10.02 - Fixed handling of empty strings and
                  added more identification for error
                  messages.

1.00 2000.09.29 - Pre-release version

´Ø¿ô

utf8_charset_alias({ $alias => $charset });

ʸ»ú¥»¥Ã¥ÈÊÌ̾¤Î¼Â¹Ô»þ¤ÎÂåÆþ¤Ë»È¤ï¤ì¤Þ¤¹¡£

°ú¿ô¤Ê¤·¤Ç¸Æ¤Ð¤ì¤ë¤È¡¢ÄêµÁ¤µ¤ì¤Æ¤¤¤ëÊÌ̾¤È¡¢¤½¤ì¤Ë¥Þ¥Ã¥×¤µ¤ì¤ëʸ»ú¥»¥Ã¥È¤Î¥Ï¥Ã¥·¥å¤òÊÖ¤·¤Þ¤¹¡£

Î㡧:

my $aliases     = utf8_charset_alias;
my @alias_names = keys %$aliases;

£±¤Ä¤Î¥Ñ¥é¥á¡¼¥¿ÉÕ¤­¤Ç¸Æ¤Ð¤ì¤ë¤È¡¢¤â¤·¤½¤ÎÊÌ̾¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢'ËÜÅö¤Î'ʸ»ú¥»¥Ã¥È¤Î̾Á°¤òÊÖ¤·¤Þ¤¹¡£¤½¤ì¤¬ÊÌ̾¤Ë¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ðundef¤òÊÖ¤·¤Þ¤¹¡£

Î㡧

if (! utf8_charset_alias('VISCII')) {
    # No alias for this
}

¤â¤·'alias' => 'charset'¤ÎÁȤΥꥹ¥È¤Ç¸Æ¤Ð¤ì¤ì¤Ð¡¢¤½¤ì¤é¤ÎÊÌ̾¤¬»È¤¨¤ë¤è¤¦¤ËÄêµÁ¤·¤Þ¤¹¡£

Î㡧

utf8_charset_alias({ 'japanese' => 'sjis', 'japan' => 'sjis' });

Ãí°Õ¡§ÅϤµ¤ì¤¿ÁȤ¬¡¢Í½¤áÄêµÁ¤µ¤ì¤Æ¤¤¤ëʸ»ú¥»¥Ã¥È¡¦¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î½¸¹ç¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ëʸ»ú¥»¥Ã¥È¤Ë¥Þ¥Ã¥×¤µ¤ì¤Ê¤±¤ì¤Ð¡¢croak¤·¤Þ¤¹¡£¤³¤ì¤Ï¾¤ÎÊÌ̾¤Ø¤ÎÊÌ̾¤òµö¤·¤Æ¤Ï¤¤¤Þ¤»¤ó¡£

Ê£¿ô¤Îʸ»ú¥»¥Ã¥È¤ò£±²ó¤Î¸Æ½Ð¤·¤ÇÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

ÊÌ̾¤ò¥¯¥ê¡¼¥ó¤¹¤ë¤¿¤á¤Ë¤Ï¡¢undef¤Îʸ»ú¥»¥Ã¥È¥Þ¥Ã¥Ô¥ó¥°¤òÅϤ·¤Þ¤¹¡£

Î㡧

utf8_charset_alias({ 'japanese' => undef });

ÊÌ̾¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë´Ö¡¢¤â¤·Í½¤áÄêµÁ¤µ¤ì¤Æ¤¤¤ëʸ»ú¥»¥Ã¥È¤Ç¤¢¤ì¤Ð¡¢'utf8_supported_charset' ´Ø¿ô¤ÏÊÌ̾¤òÊÖ¤·¤Þ¤¹¡£

´ðËܤÎÄêµÁ¤µ¤ì¤¿Ê¸»ú¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤òÊÌ̾¤Ç¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë¤È¡¢É¸½à¥¨¥é¡¼¡ÊSTDERR)¤Ø¤Î·Ù¹ð¥á¥Ã¥»¡¼¥¸¤ò½Ð¤·¤Þ¤¹¡£

utf8_supported_charset($charset_name);

¡Ê¥æ¡¼¥¶¤¬ÄêµÁ¤·¤¿ÊÌ̾¤â´Þ¤á¤Æ¡Ë̾¤Å¤±¤é¤ì¤¿Ê¸»ú¥»¥Ã¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ì¤Ðtrue¤òÊÖ¤·¤Þ¤¹¡£<p>¤½¤¦¤Ç¤Ê¤±¤ì¤Ðfalse¤òÊÖ¤·¤Þ¤¹¡£

Î㡧

if (! utf8_supported_charset('VISCII')) {
    # ¤Þ¤À¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó
}

¥Ñ¥é¥á¡¼¥¿¤Ê¤·¤Ç¡¢¥ê¥¹¥È¡¦¥³¥ó¥Æ¥­¥¹¥È¤Ç¸Æ¤Ð¤ì¤ë¤È¡¢¡Ê¥æ¡¼¥¶¤¬ÄêµÁ¤·¤¿ÊÌ̾¤â´Þ¤á¤Æ¡Ë¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤¹¤Ù¤Æ¤Îʸ»ú¥»¥Ã¥È̾¤Î¥ê¥¹¥È¤òÊÖ¤·¤Þ¤¹¡£

Î㡧

my @charsets = utf8_supported_charset;
to_utf8({ -string => $string, -charset => $source_charset });

»ØÄꤵ¤ì¤¿¸µ¤Îʸ»ú¥»¥Ã¥È(source charset)¤«¤éUTF8¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤òÊÖ¤·¤Þ¤¹¡£

from_utf8({ -string => $string, -charset => $target_charset});

UTF8¤«¤é»ØÄꤵ¤ì¤¿¥¿¡¼¥²¥Ã¥È¤Îʸ»ú¥»¥Ã¥È(target charset)¤ËÊÑ´¹¤µ¤ì¤¿Ê¸»úÎó¤òÊÖ¤·¤Þ¤¹¡£

¥Ð¡¼¥¸¥ç¥ó

1.11 - 2005.10.10

¤ä¤ë¤Ù¤­¤³¤È

Jcode¡¢2¥Ð¥¤¥È¡¦¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤½¤·¤Æ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÌ̾¤Î¤¿¤á¤ÎµÕ¹Ô¥Æ¥¹¥È

»²¹Í»ñÎÁ

Unicode::String Unicode::Map8 Unicode::Map Jcode

Ãøºî¸¢

Copyright 2000-2005, Benjamin Franz. All rights reserved.

ºî¼Ô

Benjamin Franz <snowhare@nihongo.org>

¥¯¥ì¥¸¥Ã¥È

Àî¹ç¹§Åµ "Kawai,Takanori" <GCD00051@nifty.ne.jp> - Ë®Ìõ

¥é¥¤¥»¥ó¥¹

Perl ¤ÈƱ¤¸¥é¥¤¥»¥ó¥¹¡Ê Artistic License ¤È GPL ¤Î¥Ç¥å¥¢¥ë¥é¥¤¥»¥ó¥¹¡Ë

¡Ê¸¶Ê¸¤Î¤Þ¤Þ¡Ë

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

This means that you can, at your option, redistribute it and/or modify it under either the terms the GNU Public License (GPL) version 1 or later, or under the Perl Artistic License.

See http://dev.perl.org/licenses/

DISCLAIMER

¡Ê¸¶Ê¸¤Î¤Þ¤Þ¡Ë

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Use of this software in any way or in any form, source or binary, is not allowed in any country which prohibits disclaimers of any implied warranties of merchantability or fitness for a particular purpose or any disclaimers of a similar nature.

IN NO EVENT SHALL I BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION (INCLUDING, BUT NOT LIMITED TO, LOST PROFITS) EVEN IF I HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE

1 POD Error

The following errors were encountered while parsing the POD:

Around line 2:

Non-ASCII character seen before =encoding in '̾Á°'. Assuming CP1252