HTTP::MobileAttribute::Plugin::Encoding - HTTP::MobileAttribute と Encode::JP::Mobile とのつなぎこみ


HTTP-MobileAttribute documentation Contained in the HTTP-MobileAttribute distribution.

Index


Code Index:

NAME

Top

HTTP::MobileAttribute::Plugin::Encoding - HTTP::MobileAttribute と Encode::JP::Mobile とのつなぎこみ

SYNOPSIS

Top

    use HTTP::MobileAttribute plugins => ['Encoding'];
    use Encode;
    use Encode::JP::Mobile;

    my $ma = HTTP::MobileAttribute->new($ua);
    $ma->can_display_utf8; # => 1 or 0
    decode($ma->encoding, $r->param('foo'));

DESCRIPTION

Top

Encode::JP::Mobile とのつなぎこみをします。

METHODS

Top

can_display_utf8

UTF-8 が表示できる端末かどうかを返します。

encoding

Encode::JP::Mobile で使えるエンコーディング名を返します。

AUTHORS

Top

Tokuhiro Matsuno

SEE ALSO

Top

HTTP::MobileAttribute


HTTP-MobileAttribute documentation Contained in the HTTP-MobileAttribute distribution.

package HTTP::MobileAttribute::Plugin::Encoding;
use strict;
use warnings;
use base qw/HTTP::MobileAttribute::Plugin/;

__PACKAGE__->depends([qw/XHTMLCompliant IS::ThirdForce/]);

sub can_display_utf8 :Method {
    my ($self, $c) = @_;
    $c->encoding =~ /utf-?8/ ? 1 : 0;
}

sub encoding_non_mobile :CarrierMethod('NonMobile',  'encoding') { 'utf-8' }
sub encoding_airh_phone :CarrierMethod('AirHPhone',  'encoding') { 'x-sjis-airh' }
sub encoding_ezweb      :CarrierMethod('EZweb',      'encoding') { 'x-sjis-ezweb-auto' }
sub encoding_thirdforce :CarrierMethod('ThirdForce', 'encoding') {
    $_[1]->is_type_3gc ? 'x-utf8-vodafone' : 'x-sjis-vodafone'
}
sub encoding_docomo     :CarrierMethod('DoCoMo',     'encoding') {
    "x-@{[ $_[1]->xhtml_compliant ? 'utf8' : 'sjis' ]}-docomo";
}

1;
__END__