Author image Tatsuhiko Miyagawa

NAME

HTML::Entities::ImodePictogram - i-modeÍѳ¨Ê¸»ú¤Î¥¨¥ó¥³¡¼¥É/¥Ç¥³¡¼¥É

SYNOPSIS

  use HTML::Entities::ImodePictogram;

  $html      = encode_pictogram($rawtext);
  $rawtext   = decode_pictogram($html);
  $cleantext = remove_pictogram($rawtext);

  use HTML::Entities::ImodePictogram qw(find_pictogram);

  $num_found = find_pictogram($rawtext, \&callback);

DESCRIPTION

HTML::Entities::ImodePictogram ¤Ï¡¢ Shift_JIS ¥×¥é¥¤¥Ù¡¼¥ÈÎΰè¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¡¢i-modeÍѳ¨Ê¸»ú¤ò½èÍý¤¹¤ë¥â¥¸¥å¡¼¥ë¤Ç¤¹¡£

i-modeÍѳ¨Ê¸»ú¤Ë¤Ä¤¤¤Æ¤Î¾ÜºÙ¤Ï¡¢http://www.nttdocomo.co.jp/i/tag/emoji/index.html ¤ò¤´Í÷¤¯¤À¤µ¤¤¡£

FUNCTIONS

¤³¤Î¥â¥¸¥å¡¼¥ë¤Î¤¹¤Ù¤Æ¤Î´Ø¿ô¤Ç¤Ï¡¢Æþ½ÐÎϤÎʸ»úÎó¤Ï Shift_JIS ¤Ç¥¨¥ó¥³¡¼¥É¤µ¤ì¤Æ¤¤¤ë¤ÈÁÛÄꤷ¤Æ¤¤¤Þ¤¹¡£Shift_JIS ¤È EUC-JP ¤ä UTF8 ¤Ê¤É¾¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤È¤Î¥³¡¼¥ÉÊÑ´¹¤Ë¤Ä¤¤¤Æ¤Ï¡¢Jcode ¤ò¤´Í÷¤¯¤À¤µ¤¤¡£

¤³¤Î¥â¥¸¥å¡¼¥ë¤Ï°Ê²¼¤Î´Ø¿ô¤ò¥Ç¥Õ¥©¥ë¥È¤Ç¥¨¥¯¥¹¥Ý¡¼¥È¤·¤Þ¤¹¡£

encode_pictogram
  $html = encode_pictogram($rawtext);
  $html = encode_pictogram($rawtext, unicode => 1);

¥Æ¥­¥¹¥È¤Ë´Þ¤Þ¤ì¤ë i-modeÍѳ¨Ê¸»ú¤òHTML»²¾È¤Ë¥¨¥ó¥³¡¼¥É¤·¤Þ¤¹¡£$rawtext ¤¬³ÈÄ¥³¨Ê¸»ú¤ò´Þ¤à¾ì¹ç¡¢Unicode ¥³¡¼¥É¥Ý¥¤¥ó¥È () ¤Ç¥¨¥ó¥³¡¼¥É¤·¤Þ¤¹¡£unicode ¥ª¥×¥·¥ç¥ó¤òÌÀ¼¨Åª¤ËÍ¿¤¨¤¿¾ì¹ç¡¢¤¹¤Ù¤Æ¤Î³¨Ê¸»ú¤ò Unicode ¥³¡¼¥É¥Ý¥¤¥ó¥È¤Ç¥¨¥ó¥³¡¼¥É¤·¤Þ¤¹¡£¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢SJIS10¿Ê¿ô (&#NNNNN;) ¤Ç¥¨¥ó¥³¡¼¥É¤·¤Þ¤¹¡£

decode_pictogram
  $rawtext = decode_pictogram($html);

i-modeÍѳ¨Ê¸»ú¤ÎHTML»²¾È( ¤È &#NNNNN; ¤ÎξÊý)¤ò¡¢¼ÂÂÎ¤Ë Shift_JIS ¤Ç¥Ç¥³¡¼¥É¤·¤Þ¤¹¡£

remove_pictogram
  $cleantext = remove_pictogram($rawtext);

¥Æ¥­¥¹¥È¤Ë´Þ¤Þ¤ì¤ë i-modeÍѳ¨Ê¸»ú¤òºï½ü¤·¤Þ¤¹¡£

¤³¤Î¥â¥¸¥å¡¼¥ë¤Ï°Ê²¼¤Î´Ø¿ô¤òɬÍפʤé¤Ð¥¨¥¯¥¹¥Ý¡¼¥È¤·¤Þ¤¹¡£

find_pictogram
  $num_found = find_pictorgram($rawtext, \&callback);

¥Æ¥­¥¹¥ÈÃæ¤Î i-modeÍѳ¨Ê¸»ú¤òõ¤·¤Æ¡¢¸«¤Ä¤«¤Ã¤¿¤é¤½¤ì¤¾¤ì¤ËÂФ·¤Æ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ò¼Â¹Ô¤·¤Þ¤¹¡£¸«¤Ä¤«¤Ã¤¿³¨Ê¸»ú¤Î¿ô¤òÊÖ¤·¤Þ¤¹¡£

¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Ë¤Ï3¤Ä¤Î°ú¿ô¤¬ÅϤê¤Þ¤¹¡£1¤Ä¤á¤Ï¸«¤Ä¤«¤Ã¤¿³¨Ê¸»ú¤Î¥Ð¥¤¥Ê¥ê¤½¤Î¤â¤Î¡¢2¤Ä¤á¤Ï¤½¤Î³¨Ê¸»ú¤ÎShift_JIS¥³¡¼¥É¥Ý¥¤¥ó¥È¤ò¼¨¤¹10¿Ê¿ô¤Î¿ô»ú, 3¤Ä¤á¤Ï Unicode ¥³¡¼¥É¥Ý¥¤¥ó¥È¤Ç¤¹¡£¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ÎÊÖ¤êÃͤˤè¤Ã¤Æ¡¢¤â¤È¤Î¥Æ¥­¥¹¥È¤ÏÃÖ´¹¤µ¤ì¤Þ¤¹¡£

encode_pictogram() ¤Î´Êñ¤Ê¤¢¼ÂÁõ¤ò¾Ò²ð¤·¤Þ¤¹¡£find_pictorgram() ¤Î»È¤¤Êý¤Î¤è¤¤Îã¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£¤³¤ÎÎã¤Ç¤Ï¡¢³ÈÄ¥³¨Ê¸»ú¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£

  sub encode_pictogram {
      my $text = shift;
      find_pictogram($text, sub {
                         my($bin, $number, $cp) = @_;
                         return '&#' . $number . ';';
                     });
      return $text;
  }

CAVEAT

  • ¥Æ¥­¥¹¥ÈÃæ¤Î¤¹¤Ù¤Æ¤Îʸ»ú¤Ë¥Þ¥Ã¥Á¤¹¤ëÀµµ¬É½¸½¤òÍøÍѤ·¤Æ¤¤¤ë¤¿¤á¡¢¤³¤Î¥â¥¸¥å¡¼¥ë¤ÎÆ°ºî¤ÏÃÙ¤¤¤Ç¤¹¡£¤³¤ì¤Ï¡¢Shift_JIS ¤Îʸ»ú¶­³¦¤ò¸«¤Ä¤±¤ë¤Ë¤Ï¡¢¤¹¤Ù¤Æ¥Þ¥Ã¥Á¤µ¤»¤ë¤·¤«¤Ê¤¤¤Î¤¬¸¶°ø¤Ç¤¹¡£

  • ³ÈÄ¥³¨Ê¸»ú¤Î¥µ¥Ý¡¼¥È¤Ï´°Á´¤È¤Ï¸À¤¨¤Þ¤»¤ó¡£³¨Ê¸»ú¤ò Unicode ¤Ç°·¤¤¤¿¤¤¾ì¹ç¤Ï¡¢perl 5.8.0 °Ê¾å¤ËÉÕ°¤Î Encode ¥â¥¸¥å¡¼¥ë¤ä¡¢Unicode::Japanese ¤ò¸«¤Æ¤¯¤À¤µ¤¤¡£

AUTHOR

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

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

SEE ALSO

HTML::Entities, Unicode::Japanese, http://www.nttdocomo.co.jp/p_s/imode/tag/emoji/

1 POD Error

The following errors were encountered while parsing the POD:

Around line 3:

Non-ASCII character seen before =encoding in 'i-modeÍѳ¨Ê¸»ú¤Î¥¨¥ó¥³¡¼¥É/¥Ç¥³¡¼¥É'. Assuming ISO8859-1