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