def call(env)
mobile = env['rack.jpmobile']
status, env, response = @app.call(env)
if mobile and env['Content-Type'] =~ %r!text/html|application/xhtml\+xml!
type, charset = env['Content-Type'].split(/;\s*charset=/)
body = response_to_body(response)
body = body.gsub(/<input name="utf8" type="hidden" value="#{[0x2713].pack("U")}"[^>]*?>/, ' ')
body = body.gsub(/<input name="utf8" type="hidden" value="✓"[^>]*?>/, ' ')
response, charset = mobile.to_external(body, type, charset)
if type and charset
env['Content-Type'] = "#{type}; charset=#{charset}"
end
end
new_response = ::Rack::Response.new(response, status, env)
new_response.finish
end