| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Encode::JP::Emoji::Encoding - Emoji encodings |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
This module implements all encodings provided by the package. |
|
8
|
|
|
|
|
|
|
Use L instead of loading this module directly. |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 AUTHOR |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Yusuke Kawasaki, L |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
L |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Copyright 2009-2010 Yusuke Kawasaki, all rights reserved. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
21
|
|
|
21
|
|
1478
|
use strict; |
|
|
21
|
|
|
|
|
42
|
|
|
|
21
|
|
|
|
|
839
|
|
|
25
|
21
|
|
|
21
|
|
115
|
use warnings; |
|
|
21
|
|
|
|
|
41
|
|
|
|
21
|
|
|
|
|
952
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding; |
|
28
|
21
|
|
|
21
|
|
138
|
use base qw(Encode::Encoding); |
|
|
21
|
|
|
|
|
44
|
|
|
|
21
|
|
|
|
|
5192
|
|
|
29
|
21
|
|
|
21
|
|
106795
|
use Encode::JP::Emoji::Mapping; |
|
|
21
|
|
|
|
|
122
|
|
|
|
21
|
|
|
|
|
16124
|
|
|
30
|
21
|
|
|
21
|
|
327
|
use Carp (); |
|
|
21
|
|
|
|
|
40
|
|
|
|
21
|
|
|
|
|
404
|
|
|
31
|
21
|
|
|
21
|
|
133
|
use Encode (); |
|
|
21
|
|
|
|
|
45
|
|
|
|
21
|
|
|
|
|
13946
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our $VERSION = '0.60'; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $ascii_encoding = Encode::find_encoding('us-ascii'); |
|
36
|
|
|
|
|
|
|
sub sub_check { |
|
37
|
37543
|
|
|
37543
|
0
|
54784
|
my $check = $_[1]; |
|
38
|
37543
|
100
|
|
|
|
109714
|
return $check unless $check; # undef or 0 |
|
39
|
8449
|
100
|
|
|
|
28746
|
return $check if ref $check; # sub-routine |
|
40
|
|
|
|
|
|
|
return sub { |
|
41
|
4202
|
|
|
4202
|
|
54484
|
$ascii_encoding->encode(chr $_[0], $check); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
4218
|
|
|
|
|
21851
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub no_sub_check { |
|
46
|
22991
|
|
|
22991
|
0
|
37154
|
my $check = $_[1]; |
|
47
|
22991
|
|
|
|
|
37145
|
$check; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub decode { |
|
51
|
17613
|
|
|
17613
|
1
|
6888897
|
my ($self, $octets, $check) = @_; |
|
52
|
17613
|
50
|
|
|
|
43798
|
return undef unless defined $octets; |
|
53
|
17613
|
|
100
|
|
|
81598
|
$check ||=0; |
|
54
|
17613
|
|
|
|
|
42281
|
my $subcheck = $self->sub_check($check); |
|
55
|
17613
|
|
|
|
|
41034
|
my $nosubcheck = $self->no_sub_check($check); |
|
56
|
17613
|
100
|
100
|
|
|
44268
|
my $copy = $octets if $check and !($check & Encode::LEAVE_SRC()); |
|
57
|
17613
|
50
|
|
|
|
39611
|
$octets .= '' if ref $octets; # stringify; |
|
58
|
17613
|
|
|
|
|
48128
|
$self->before_decode($octets, $subcheck); |
|
59
|
17613
|
|
|
|
|
37972
|
my $string = $self->byte_encoding->decode($octets, $nosubcheck); |
|
60
|
17613
|
|
|
|
|
105037
|
$self->after_decode($string, $subcheck); |
|
61
|
17613
|
100
|
100
|
|
|
59759
|
$_[1] = $copy if $check and !($check & Encode::LEAVE_SRC()); |
|
62
|
17613
|
|
|
|
|
70745
|
$string; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub encode { |
|
66
|
19930
|
|
|
19930
|
1
|
11228322
|
my ($self, $string, $check) = @_; |
|
67
|
19930
|
50
|
|
|
|
64788
|
return undef unless defined $string; |
|
68
|
19930
|
|
100
|
|
|
73197
|
$check ||=0; |
|
69
|
19930
|
|
|
|
|
57968
|
my $subcheck = $self->sub_check($check); |
|
70
|
19930
|
|
|
|
|
62129
|
my $nosubcheck = $self->no_sub_check($check); |
|
71
|
19930
|
100
|
100
|
|
|
106957
|
my $copy = $string if $check and !($check & Encode::LEAVE_SRC()); |
|
72
|
19930
|
50
|
|
|
|
49098
|
$string .= '' if ref $string; # stringify; |
|
73
|
19930
|
|
|
|
|
96572
|
$self->before_encode($string, $subcheck); |
|
74
|
19930
|
|
|
|
|
84166
|
my $octets = $self->byte_encoding->encode($string, $nosubcheck); |
|
75
|
19930
|
|
|
|
|
54196
|
$self->after_encode($octets, $subcheck); |
|
76
|
19930
|
100
|
100
|
|
|
86774
|
$_[1] = $copy if $check and !($check & Encode::LEAVE_SRC()); |
|
77
|
19930
|
|
|
|
|
84630
|
$octets; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
17613
|
|
|
17613
|
0
|
29704
|
sub before_decode {} |
|
81
|
0
|
|
|
0
|
0
|
0
|
sub after_decode {} |
|
82
|
0
|
|
|
0
|
0
|
0
|
sub before_encode {} |
|
83
|
19930
|
|
|
19930
|
0
|
35417
|
sub after_encode {} |
|
84
|
0
|
|
|
0
|
0
|
0
|
sub byte_encoding { Carp::croak "byte_encoding not implemented"; } |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Shift_JIS Base |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::Shift_JIS; |
|
89
|
21
|
|
|
21
|
|
148
|
use base 'Encode::JP::Emoji::Encoding'; |
|
|
21
|
|
|
|
|
41
|
|
|
|
21
|
|
|
|
|
4273
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
24
|
|
|
24
|
|
40239
|
sub mime_name { 'Shift_JIS'; } |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $cp932_encoding = Encode::find_encoding('cp932'); |
|
94
|
|
|
|
|
|
|
sub byte_encoding { |
|
95
|
22991
|
|
|
22991
|
|
124420
|
$cp932_encoding; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# UTF8 Base |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::UTF8; |
|
101
|
21
|
|
|
21
|
|
126
|
use base 'Encode::JP::Emoji::Encoding'; |
|
|
21
|
|
|
|
|
43
|
|
|
|
21
|
|
|
|
|
4472
|
|
|
102
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-emoji-docomo-pp'); |
|
103
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-emoji-kddiapp-pp'); |
|
104
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-emoji-kddiweb-pp'); |
|
105
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-emoji-softbank3g-pp'); |
|
106
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-google-pp'); |
|
107
|
|
|
|
|
|
|
|
|
108
|
30
|
|
|
30
|
|
33218
|
sub mime_name { 'UTF-8'; } |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $utf8_encoding = Encode::find_encoding('UTF-8'); |
|
111
|
|
|
|
|
|
|
sub byte_encoding { |
|
112
|
14552
|
|
|
14552
|
|
98890
|
$utf8_encoding; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub no_sub_check { |
|
116
|
14552
|
|
|
14552
|
|
20180
|
my $check = $_[1]; |
|
117
|
14552
|
100
|
|
|
|
35733
|
return 0 if ref $check; |
|
118
|
12425
|
|
|
|
|
22895
|
$check; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# DoCoMo |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_EMOJI_DOCOMO_PP; |
|
124
|
21
|
|
|
21
|
|
133
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
42
|
|
|
|
21
|
|
|
|
|
15656
|
|
|
125
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-emoji-docomo-pp'); |
|
126
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::docomo_cp932_to_docomo_unicode; |
|
127
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::docomo_unicode_to_docomo_cp932; |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_E4U_DOCOMO_PP; |
|
130
|
21
|
|
|
21
|
|
144
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
59
|
|
|
|
21
|
|
|
|
|
11685
|
|
|
131
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-e4u-docomo-pp'); |
|
132
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::docomo_cp932_to_google_unicode; |
|
133
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_docomo_cp932; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_DOCOMO_PP; |
|
136
|
21
|
|
|
21
|
|
157
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
60
|
|
|
|
21
|
|
|
|
|
12571
|
|
|
137
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-docomo-pp'); |
|
138
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::docomo_unicode_to_google_unicode; |
|
139
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_docomo_unicode; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# KDDIapp |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_EMOJI_KDDIAPP_PP; |
|
144
|
21
|
|
|
21
|
|
312
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
42
|
|
|
|
21
|
|
|
|
|
12491
|
|
|
145
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-emoji-kddiapp-pp'); |
|
146
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::kddi_cp932_to_kddi_unicode; |
|
147
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::kddi_unicode_to_kddi_cp932; |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_E4U_KDDIAPP_PP; |
|
150
|
21
|
|
|
21
|
|
139
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
44
|
|
|
|
21
|
|
|
|
|
15342
|
|
|
151
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-e4u-kddiapp-pp'); |
|
152
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::kddi_cp932_to_google_unicode; |
|
153
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_kddi_cp932; |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_KDDIAPP_PP; |
|
156
|
21
|
|
|
21
|
|
202
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
36
|
|
|
|
21
|
|
|
|
|
23373
|
|
|
157
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-kddiapp-pp'); |
|
158
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::kddi_unicode_to_google_unicode; |
|
159
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_kddi_unicode; |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
# KDDIweb |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_EMOJI_KDDIWEB_PP; |
|
164
|
21
|
|
|
21
|
|
138
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
40
|
|
|
|
21
|
|
|
|
|
12482
|
|
|
165
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-emoji-kddiweb-pp'); |
|
166
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::kddiweb_cp932_to_kddiweb_unicode; |
|
167
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::kddiweb_unicode_to_kddiweb_cp932; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_E4U_KDDIWEB_PP; |
|
170
|
21
|
|
|
21
|
|
129
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
39
|
|
|
|
21
|
|
|
|
|
11238
|
|
|
171
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-e4u-kddiweb-pp'); |
|
172
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::kddiweb_cp932_to_google_unicode; |
|
173
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_kddiweb_cp932; |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_KDDIWEB_PP; |
|
176
|
21
|
|
|
21
|
|
129
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
40
|
|
|
|
21
|
|
|
|
|
12036
|
|
|
177
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-kddiweb-pp'); |
|
178
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::kddiweb_unicode_to_google_unicode; |
|
179
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_kddiweb_unicode; |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
# SoftBank 2G |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_EMOJI_SOFTBANK2G_PP; |
|
184
|
21
|
|
|
21
|
|
144
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
58
|
|
|
|
21
|
|
|
|
|
18374
|
|
|
185
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-emoji-softbank2g-pp'); |
|
186
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Encoding::Util::softbankauto_cp932_to_softbank_unicode; |
|
187
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Encoding::Util::softbank_unicode_to_softbank_escape; |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_EMOJI_SOFTBANK2G_PP; |
|
190
|
21
|
|
|
21
|
|
152
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
40
|
|
|
|
21
|
|
|
|
|
12877
|
|
|
191
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-emoji-softbank2g-pp'); |
|
192
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Encoding::Util::softbank_escape_to_softbank_unicode; |
|
193
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Encoding::Util::softbank_unicode_to_softbank_escape; |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_E4U_SOFTBANK2G_PP; |
|
196
|
21
|
|
|
21
|
|
150
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
42
|
|
|
|
21
|
|
|
|
|
19129
|
|
|
197
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-e4u-softbank2g-pp'); |
|
198
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Encoding::Util::softbankauto_cp932_to_google_unicode; |
|
199
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Encoding::Util::google_unicode_to_softbank_escape; |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_SOFTBANK2G_PP; |
|
202
|
21
|
|
|
21
|
|
140
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
41
|
|
|
|
21
|
|
|
|
|
13020
|
|
|
203
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-softbank2g-pp'); |
|
204
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Encoding::Util::softbankauto_unicode_to_google_unicode; |
|
205
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Encoding::Util::google_unicode_to_softbank_escape; |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
# SoftBank 3G |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_EMOJI_SOFTBANK3G_PP; |
|
210
|
21
|
|
|
21
|
|
145
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
46
|
|
|
|
21
|
|
|
|
|
13163
|
|
|
211
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-emoji-softbank3g-pp'); |
|
212
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::softbank_cp932_to_softbank_unicode; |
|
213
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::softbank_unicode_to_softbank_cp932; |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_E4U_SOFTBANK3G_PP; |
|
216
|
21
|
|
|
21
|
|
139
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
40
|
|
|
|
21
|
|
|
|
|
11902
|
|
|
217
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-e4u-softbank3g-pp'); |
|
218
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::softbank_cp932_to_google_unicode; |
|
219
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_softbank_cp932; |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_SOFTBANK3G_PP; |
|
222
|
21
|
|
|
21
|
|
134
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
45
|
|
|
|
21
|
|
|
|
|
12804
|
|
|
223
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-softbank3g-pp'); |
|
224
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::softbank_unicode_to_google_unicode; |
|
225
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_softbank_unicode; |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
# Mixed |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_MIXED_PP; |
|
230
|
21
|
|
|
21
|
|
140
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
42
|
|
|
|
21
|
|
|
|
|
16179
|
|
|
231
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-mixed-pp'); |
|
232
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::mixed_unicode_to_google_unicode; |
|
233
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_mixed_unicode; |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# Unicode Standard |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_UNICODE_PP; |
|
238
|
21
|
|
|
21
|
|
159
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
67
|
|
|
|
21
|
|
|
|
|
11723
|
|
|
239
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-unicode-pp'); |
|
240
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Mapping::unicode_unicode_to_google_unicode; |
|
241
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Mapping::google_unicode_to_unicode_unicode; |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
# No PUA |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_UTF8_E4U_NONE_PP; |
|
246
|
21
|
|
|
21
|
|
135
|
use base 'Encode::JP::Emoji::Encoding::UTF8'; |
|
|
21
|
|
|
|
|
43
|
|
|
|
21
|
|
|
|
|
11221
|
|
|
247
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-emoji-none-pp'); |
|
248
|
|
|
|
|
|
|
__PACKAGE__->Define('x-utf8-e4u-none-pp'); |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Encoding::Util::no_emoji; |
|
251
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Encoding::Util::no_emoji; |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::X_SJIS_E4U_NONE_PP; |
|
254
|
21
|
|
|
21
|
|
142
|
use base 'Encode::JP::Emoji::Encoding::Shift_JIS'; |
|
|
21
|
|
|
|
|
44
|
|
|
|
21
|
|
|
|
|
13017
|
|
|
255
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-emoji-none-pp'); |
|
256
|
|
|
|
|
|
|
__PACKAGE__->Define('x-sjis-e4u-none-pp'); |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
*after_decode = \&Encode::JP::Emoji::Encoding::Util::no_emoji; |
|
259
|
|
|
|
|
|
|
*before_encode = \&Encode::JP::Emoji::Encoding::Util::no_emoji; |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
# Utils |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
package Encode::JP::Emoji::Encoding::Util; |
|
264
|
21
|
|
|
21
|
|
45806
|
use Encode::JP::Emoji::Property; |
|
|
21
|
|
|
|
|
64
|
|
|
|
21
|
|
|
|
|
20005
|
|
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
sub softbank_escape_to_softbank_unicode { |
|
267
|
1426
|
|
|
1426
|
|
11386
|
$_[1] =~ s{ |
|
268
|
|
|
|
|
|
|
\x1B\x24([GEFOPQ])([\x20-\x7F]+)\x0F? |
|
269
|
|
|
|
|
|
|
}{ |
|
270
|
1431
|
|
|
|
|
6164
|
&escape_vodafone($1, $2) |
|
271
|
|
|
|
|
|
|
}egomx; |
|
272
|
|
|
|
|
|
|
} |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub softbankauto_cp932_to_softbank_unicode { |
|
275
|
484
|
50
|
|
484
|
|
2852
|
if ($_[1] =~ /\x1B\x24/) { |
|
276
|
484
|
|
|
|
|
1818
|
Encode::JP::Emoji::Mapping::softbank_cp932_to_softbank_unicode(@_); |
|
277
|
484
|
|
|
|
|
1240
|
Encode::JP::Emoji::Encoding::Util::softbank_escape_to_softbank_unicode(@_); |
|
278
|
|
|
|
|
|
|
} else { |
|
279
|
0
|
|
|
|
|
0
|
Encode::JP::Emoji::Mapping::softbank_cp932_to_softbank_unicode(@_); |
|
280
|
|
|
|
|
|
|
} |
|
281
|
|
|
|
|
|
|
} |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub softbankauto_cp932_to_google_unicode { |
|
284
|
471
|
50
|
|
471
|
|
2549
|
if ($_[1] =~ /\x1B\x24/) { |
|
285
|
471
|
|
|
|
|
2644
|
Encode::JP::Emoji::Mapping::softbank_cp932_to_softbank_unicode(@_); |
|
286
|
471
|
|
|
|
|
1889
|
Encode::JP::Emoji::Encoding::Util::softbank_escape_to_softbank_unicode(@_); |
|
287
|
471
|
|
|
|
|
2256
|
Encode::JP::Emoji::Mapping::softbank_unicode_to_google_unicode(@_); |
|
288
|
|
|
|
|
|
|
} else { |
|
289
|
0
|
|
|
|
|
0
|
Encode::JP::Emoji::Mapping::softbank_cp932_to_google_unicode(@_); |
|
290
|
|
|
|
|
|
|
} |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
sub softbankauto_unicode_to_google_unicode { |
|
294
|
471
|
50
|
|
471
|
|
2075
|
if ($_[1] =~ /\x1B\x24/) { |
|
295
|
0
|
|
|
|
|
0
|
Encode::JP::Emoji::Encoding::Util::softbank_escape_to_softbank_unicode(@_); |
|
296
|
0
|
|
|
|
|
0
|
Encode::JP::Emoji::Mapping::softbank_unicode_to_google_unicode(@_); |
|
297
|
|
|
|
|
|
|
} else { |
|
298
|
471
|
|
|
|
|
2128
|
Encode::JP::Emoji::Mapping::softbank_unicode_to_google_unicode(@_); |
|
299
|
|
|
|
|
|
|
} |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub softbank_unicode_to_softbank_escape { |
|
303
|
0
|
|
50
|
0
|
|
0
|
my $check = $_[2] || sub {''}; |
|
|
1897
|
|
|
1897
|
|
14436
|
|
|
304
|
1897
|
|
|
|
|
13118
|
$_[1] =~ s{ |
|
305
|
|
|
|
|
|
|
(\p{InEmojiSoftBank}+) |
|
306
|
|
|
|
|
|
|
}{ |
|
307
|
1897
|
|
|
|
|
4833
|
&unescape_vodafone($1) |
|
308
|
|
|
|
|
|
|
}egomx; |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub google_unicode_to_softbank_escape { |
|
312
|
942
|
|
|
942
|
|
4099
|
Encode::JP::Emoji::Mapping::google_unicode_to_softbank_unicode(@_); |
|
313
|
942
|
|
|
|
|
2692
|
Encode::JP::Emoji::Encoding::Util::softbank_unicode_to_softbank_escape(@_); |
|
314
|
|
|
|
|
|
|
} |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
my $map_escape_vodafone = { |
|
317
|
|
|
|
|
|
|
G => 0xE000, |
|
318
|
|
|
|
|
|
|
E => 0xE100, |
|
319
|
|
|
|
|
|
|
F => 0xE200, |
|
320
|
|
|
|
|
|
|
O => 0xE300, |
|
321
|
|
|
|
|
|
|
P => 0xE400, |
|
322
|
|
|
|
|
|
|
Q => 0xE500, |
|
323
|
|
|
|
|
|
|
}; |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub escape_vodafone { |
|
326
|
1431
|
|
|
1431
|
|
2736
|
my $high = shift; |
|
327
|
1431
|
|
|
|
|
2319
|
my $code = shift; |
|
328
|
1431
|
|
|
|
|
3516
|
my $offset = $map_escape_vodafone->{$high}; |
|
329
|
1431
|
|
|
|
|
3335
|
join '' => map {chr($offset - 32 + ord $_)} split //, $code; |
|
|
1437
|
|
|
|
|
9203
|
|
|
330
|
|
|
|
|
|
|
} |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
my $map_unescape_vodafone = [qw( G E F O P Q )]; |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub unescape_vodafone { |
|
335
|
1897
|
|
|
1897
|
|
3876
|
my $string = shift; |
|
336
|
1897
|
|
|
|
|
3510
|
my $buf = []; |
|
337
|
1897
|
|
|
|
|
23688
|
my $prev = ""; |
|
338
|
1897
|
|
|
|
|
5244
|
foreach my $char (split //, $string) { |
|
339
|
1908
|
|
|
|
|
2872
|
my $code = ord $char; |
|
340
|
1908
|
|
|
|
|
4328
|
my $high = ($code & 0x0700) >> 8; |
|
341
|
1908
|
|
|
|
|
2686
|
my $low = ($code & 0xFF) + 32; |
|
342
|
1908
|
50
|
|
|
|
5372
|
my $page = $map_unescape_vodafone->[$high] or next; |
|
343
|
1908
|
100
|
|
|
|
4156
|
if ($prev eq $page) { |
|
344
|
6
|
|
|
|
|
16
|
$buf->[$#$buf] .= sprintf "%c" => $low; |
|
345
|
|
|
|
|
|
|
} else { |
|
346
|
1902
|
|
|
|
|
10123
|
push @$buf, sprintf "\x1B\x24%s%c" => $page, $low; |
|
347
|
|
|
|
|
|
|
} |
|
348
|
1908
|
|
|
|
|
5849
|
$prev = $page; |
|
349
|
|
|
|
|
|
|
} |
|
350
|
1897
|
|
|
|
|
4944
|
push @$buf, ''; |
|
351
|
1897
|
|
|
|
|
14457
|
join "\x0F" => @$buf; |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub no_emoji { |
|
355
|
0
|
|
50
|
0
|
|
0
|
my $check = $_[2] || sub {}; |
|
|
8425
|
|
|
8425
|
|
22281
|
|
|
356
|
8425
|
|
|
|
|
56484
|
$_[1] =~ s{ |
|
357
|
|
|
|
|
|
|
(\p{InEmojiAny}) |
|
358
|
|
|
|
|
|
|
}{ |
|
359
|
8425
|
|
|
|
|
39803
|
&$check(ord $1); |
|
360
|
|
|
|
|
|
|
}egomx; |
|
361
|
|
|
|
|
|
|
} |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
1; |