From 1ae4c141a3153e5235f79b2810f041d0fe583e51 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Mon, 1 Jul 2013 14:28:39 -0500 Subject: [PATCH] before cramming utf8 data into us-ascii, replace "smart" quotes and things --- script/mail_new_activity | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script/mail_new_activity b/script/mail_new_activity index 732541c..5d8a33f 100755 --- a/script/mail_new_activity +++ b/script/mail_new_activity @@ -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