before cramming utf8 data into us-ascii, replace "smart" quotes and things
This commit is contained in:
parent
a471eb180a
commit
1ae4c141a3
|
@ -9,6 +9,14 @@ Rails.application.require_environment!
|
|||
|
||||
class String
|
||||
def force_to_ascii
|
||||
# fixup some "smart" quotes and things instead of forcing them to "?" chars
|
||||
gsub("\u201C", '"').
|
||||
gsub("\u201D", '"').
|
||||
gsub("\u2018", "'").
|
||||
gsub("\u2019", "'").
|
||||
gsub("\u2013", "-").
|
||||
gsub("\u2014", "--").
|
||||
gsub("\u2026", "...").
|
||||
encode("us-ascii", :invalid => :replace, :undef => :replace,
|
||||
:replace => "?")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue