module Jpmobile::Mobile::UnicodeEmoticon

Public Instance Methods

apply_filter?() click to toggle source

Jpmobile::Rack::Filter を適用する

# File lib/jpmobile/mobile/unicode_emoticon.rb, line 4
def apply_filter?
  Jpmobile.config.smart_phone_emoticon_compatibility
end
apply_params_filter?() click to toggle source

Jpmobile::Rack::ParamsFilter を適用する

# File lib/jpmobile/mobile/unicode_emoticon.rb, line 9
def apply_params_filter?
  Jpmobile.config.smart_phone_emoticon_compatibility
end
to_external(str, content_type, charset) click to toggle source
# File lib/jpmobile/mobile/unicode_emoticon.rb, line 25
def to_external(str, content_type, charset)
  # UTF-8を数値参照に
  str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
  if unicode_emoticon?
    str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_UNICODE_EMOTICON, false)
  else
    # 数値参照を絵文字コードに変換
    str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, false)
  end

  [str, charset]
end
to_internal(str) click to toggle source

文字コード変換

# File lib/jpmobile/mobile/unicode_emoticon.rb, line 14
def to_internal(str)
  if unicode_emoticon?
    # Unicode絵文字を数値参照に変換
    str = Jpmobile::Emoticon.external_to_unicodecr_unicode60(Jpmobile::Util.utf8(str))
  else
    # SoftBank絵文字を数値参照に変換
    str = Jpmobile::Emoticon.external_to_unicodecr_softbank(Jpmobile::Util.utf8(str))
  end
  # 数値参照を UTF-8 に変換
  Jpmobile::Emoticon.unicodecr_to_utf8(str)
end
unicode_emoticon?() click to toggle source
# File lib/jpmobile/mobile/unicode_emoticon.rb, line 38
def unicode_emoticon?
  @request.user_agent.match(%r OS (\d)_/) and $1.to_i >= 5
end