Uninitialised Constant Iconv
Recently was advised to used the following code in order to avoid UTF-8 problems with input text into a database.
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
#valid_string = ic.iconv(untrusted_string + ' ')[0..-2]
row[4] = ic.iconv(row[4] + ' ')[0..-2]
row[5] = ic.iconv(row[5] + ' ')[0..-2]
In developmen开发者_开发问答t this works perfectly, however, once pushed onto our server we get the problem "uninitialised constant iconv" when we try to run the rake file containing the above code.
Is there an easy way to fix this issue? Tried adding gem 'iconv'
to the gem file and running bundle install but this produced loads of errors, so assuming this is not the correct way to fix it...
Fixed it by adding require 'iconv' at the top of the rake file
精彩评论