Reputation: 1
I had my app running in ruby 1.8.7 and rails 3.0.11 ,I upgraded it with 1.9.2 ruby and rails 3.2.2. it has a utf convertor like this
@utf8_converter = Iconv.new('UTF-8//IGNORE', 'UTF-8')
......
......
def utf8(untrusted_string)
valid_string = @utf8_converter.iconv(untrusted_string + ' ')[0..-2]
return valid_string
Unto my Understanding Iconv doesn't support ruby 1.9.2. how can make it run?
Thanks
Upvotes: 0
Views: 354
Reputation: 4879
I believe this is should get you on the right track:
def utf8(untrusted_string)
valid_string = (untrusted_string + ' ').encode('utf-8')
return valid_string
end
The @utf8_converter
variable is no longer needed as Iconv is deprecated, so you can get away with just your utf8 method.
Upvotes: 1