Sha256: 8706e2dcf1e3ebedd603aa09d961107d7f7e22f6244340b2c6e5d9174fc36cfc
Contents?: true
Size: 764 Bytes
Versions: 21
Compression:
Stored size: 764 Bytes
Contents
# coding: utf-8 class Galakei::Filter::NonStandardChar < Galakei::Filter::Base def self.inject(klass) this_class = self klass.after_filter self, :if => lambda {|c| this_class.condition?(c) } end def condition? response.content_type =~ %r{text/html|application/xhtml+xml} && (response.charset || Rails.application.config.encoding).downcase == "utf-8" end def filter body = response.body full_dot = "\u30FB" half_dot = "\uFF65" body.gsub!("·", full_dot) if request.docomo? body.gsub!("\u00B7", half_dot) unless request.softbank? body.gsub!("・", half_dot) if request.au? body.gsub!("・", full_dot) if request.au? body.gsub!("⋅", half_dot) response.body = body end end
Version data entries
21 entries across 21 versions & 1 rubygems