fix encoding bug

This commit is contained in:
Sam 2013-09-10 16:01:36 +10:00
parent edf6f3012d
commit bcf0203497

View File

@ -25,7 +25,10 @@ module ApplicationHelper
def escape_unicode(javascript)
if javascript
javascript.gsub(/\342\200\250/u, '&#x2028;').gsub(/(<\/)/u, '\u003C/').html_safe
javascript = javascript.dup.force_encoding("utf-8")
javascript.gsub!(/\342\200\250/u, '&#x2028;')
javascript.gsub!(/(<\/)/u, '\u003C/')
javascript.html_safe
else
''
end