From: "Xavier NoĂ«lle" Date: 2010-02-24T00:18:36+09:00 Subject: Re: [ENCODING] UTF8 hell 2010/2/23 Yukihiro Matsumoto : > 233 is not a valid UTF-8 character.  The byte sequence for médicals is > <109 195 169 100 105 99 97 108 115>. Indeed. In the meantime, I changed the code with this one: def isUTF8() begin self.unpack('U*') rescue return false end return true end if isUTF8() self.force_encoding('UTF-8') else self.force_encoding('ISO-8859-1') self.encode!('UTF-8') end This (ugly) quickfix works for what I need, but I don't know if this problem can be somehow resolved in another way. The problem being that my SQL database has a VARBINARY column with an unknown encoding. Is there a way to deal with the various possible encoding or to ask MySQL to return UTF8 converted data, or is it necessary to clean data before inserting them ? -- Xavier NOELLE