HTTP::MobileAgent::Plugin::Charset - Encode::JP::Mobile friendly


HTTP-MobileAgent-Plugin-Charset documentation Contained in the HTTP-MobileAgent-Plugin-Charset distribution.

Index


Code Index:

NAME

Top

HTTP::MobileAgent::Plugin::Charset - Encode::JP::Mobile friendly

SYNOPSIS

Top

  use HTTP::MobileAgent;
  use HTTP::MobileAgent::Plugin::Charset;

  my $agent = HTTP::MobileAgent->new;
  $agent->can_display_utf8; # => 1 or 0

  use Encode::JP::Mobile;
  encode($agent->encoding, "\x{223e}");

DESCRIPTION

Top

HTTP::MobileAgent::Plugin::Charset is a plugin of HTTP::MobileAgent.

You can detect encoding. The result can use with Encode::JP::Mobile.

KNOWLEDGE

Top

au phone can display utf8, but cannot display when SSL.

AUTHOR

Top

Tokuhiro Matsuno <tokuhirom aaaatttt gmail dotottto commmmm>

SEE ALSO

Top

HTTP::MobileAgent, Encode::JP::Mobile

http://www.au.kddi.com/ezfactory/tec/spec/wap_rule.html http://www.nttdocomo.co.jp/service/imode/make/content/xhtml/about/

LICENSE

Top

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


HTTP-MobileAgent-Plugin-Charset documentation Contained in the HTTP-MobileAgent-Plugin-Charset distribution.

package HTTP::MobileAgent::Plugin::Charset;
use strict;
use warnings;
use 5.00800;
our $VERSION = '0.03';

sub HTTP::MobileAgent::can_display_utf8 {
    my $self = shift;
    $self->encoding =~ /utf-?8/ ? 1 : 0;
}

sub HTTP::MobileAgent::encoding {
    my $self = shift;
    if ($self->is_non_mobile) {
        return 'utf-8';
    } elsif ($self->is_airh_phone) {
        return 'x-sjis-airh';
    } elsif ($self->is_ezweb) {
        # ezweb canot display utf8 in https.
        return 'x-sjis-ezweb-auto';
    } elsif ($self->is_vodafone) {
        if ($self->is_type_3gc) {
            return 'x-utf8-vodafone';
        } else {
            return 'x-sjis-vodafone';
        }
    } else {
        my $charset = $self->xhtml_compliant ? 'utf8' : 'sjis';
        return join '-', 'x', $charset, lc($self->carrier_longname);
    }
}

1;
__END__