forked from jpmobile/jpmobile
/
iphone.rb
36 lines (31 loc) · 984 Bytes
/
iphone.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
# =iPhone
module Jpmobile::Mobile
# ==iPhone
class Iphone < SmartPhone
# 対応するUser-Agentの正規表現
USER_AGENT_REGEXP = /iPhone/
# Jpmobile::Rack::Filter を適用する
def apply_filter?
true
end
# Jpmobile::Rack::ParamsFilter を適用する
def apply_params_filter?
true
end
# 文字コード変換
def to_internal(str)
# 絵文字を数値参照に変換
str = Jpmobile::Emoticon.external_to_unicodecr_softbank(Jpmobile::Util.utf8(str))
# 数値参照を UTF-8 に変換
Jpmobile::Emoticon.unicodecr_to_utf8(str)
end
def to_external(str, content_type, charset)
# UTF-8を数値参照に
str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
# 数値参照を絵文字コードに変換
str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, false)
[str, charset]
end
end
end