@@ -191,6 +191,11 class Changeset < ActiveRecord::Base | |||||
191 | end |
|
191 | end | |
192 | end |
|
192 | end | |
193 | # removes invalid UTF8 sequences |
|
193 | # removes invalid UTF8 sequences | |
194 | Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-3] |
|
194 | begin | |
|
195 | Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-3] | |||
|
196 | rescue Iconv::InvalidEncoding | |||
|
197 | # "UTF-8//IGNORE" is not supported on some OS | |||
|
198 | str | |||
|
199 | end | |||
195 | end |
|
200 | end | |
196 | end |
|
201 | end |
General Comments 0
You need to be logged in to leave comments.
Login now