Class Jpmobile::Filter::Sjis
In: lib/jpmobile/filter.rb
Parent: Base

Shift_JISとUnicodeのフィルタ(NKFを使用)

Methods

Public Instance methods

afterfilterを実行した後に実行する。

[Source]

    # File lib/jpmobile/filter.rb, line 92
92:       def after_after(controller)
93:         controller.response.charset = "Shift_JIS"
94:       end

to_internalを適用するべきかどうかを返す。

[Source]

     # File lib/jpmobile/filter.rb, line 96
 96:       def apply_incoming?(controller)
 97:         # Vodafone 3G/Softbank(Shift-JISにすると絵文字で不具合が生じる)以外の
 98:         # 携帯電話の場合に適用する。
 99:         mobile = controller.request.mobile
100:         mobile && !(mobile.instance_of?(Jpmobile::Mobile::Vodafone)||mobile.instance_of?(Jpmobile::Mobile::Softbank))
101:       end

[Source]

     # File lib/jpmobile/filter.rb, line 102
102:       def apply_outgoing?(controller)
103:         [nil, "text/html", "application/xhtml+xml"].include?(controller.response.content_type) &&
104:           apply_incoming?(controller)
105:       end

UTF-8からShift_JISに変換する。

[Source]

    # File lib/jpmobile/filter.rb, line 84
84:       def to_external(str, controller)
85:         NKF.nkf('-m0 -x -Ws', str)
86:       end

Shift_JISからUTF-8に変換する。

[Source]

    # File lib/jpmobile/filter.rb, line 88
88:       def to_internal(str, controller)
89:         NKF.nkf('-m0 -x -Sw', str)
90:       end

[Validate]