@@ -251,17 +251,18 class Changeset < ActiveRecord::Base | |||||
251 | str.force_encoding("UTF-8") if str.respond_to?(:force_encoding) |
|
251 | str.force_encoding("UTF-8") if str.respond_to?(:force_encoding) | |
252 | return str |
|
252 | return str | |
253 | end |
|
253 | end | |
254 | str.force_encoding("UTF-8") if str.respond_to?(:force_encoding) |
|
|||
255 | if str.respond_to?(:force_encoding) |
|
254 | if str.respond_to?(:force_encoding) | |
256 | enc = encoding.blank? ? "UTF-8" : encoding |
|
255 | enc = encoding.blank? ? "UTF-8" : encoding | |
257 | if enc != "UTF-8" |
|
256 | if enc != "UTF-8" | |
258 | str.force_encoding(enc) |
|
257 | str.force_encoding(enc) | |
259 | str = str.encode("UTF-8", :invalid => :replace, |
|
258 | str = str.encode("UTF-8", :invalid => :replace, | |
260 | :undef => :replace, :replace => '?') |
|
259 | :undef => :replace, :replace => '?') | |
261 |
e |
|
260 | else | |
262 |
|
|
261 | str.force_encoding("UTF-8") | |
263 | str = str.encode("US-ASCII", :invalid => :replace, |
|
262 | if ! str.valid_encoding? | |
264 | :undef => :replace, :replace => '?').encode("UTF-8") |
|
263 | str = str.encode("US-ASCII", :invalid => :replace, | |
|
264 | :undef => :replace, :replace => '?').encode("UTF-8") | |||
|
265 | end | |||
265 | end |
|
266 | end | |
266 | else |
|
267 | else | |
267 | unless encoding.blank? || encoding == 'UTF-8' |
|
268 | unless encoding.blank? || encoding == 'UTF-8' |
General Comments 0
You need to be logged in to leave comments.
Login now