I've been working on outlook imports (linked in exports to outlook format) but I'm having troubles with encoding. The outlook format CSV I get from exporting my LinkedIn contacts are not in UTF-8. Letters like ñ
cause an exception in the mongoid_search
gem when calling str.to_s.mb_chars.normalize
. I think encoding is the issue, because when I call mb_chars
(see first code example). I am not sure if this is a bug in the gem, but I was advised to sanitize the data nonetheless.
From File Picker, I tried using their new, community-supported gem to upload CSV data. I tried three encoding detectors and transcoders:
chardet
rchardet19
gem
iso-8859
with .8/1
confidence. ñ
Charlock_Holmes
gem
windows-1252
with 33/100
confidencerchardet
got iso-8859
because this ones based of that. charlock
, I get the error U_FILE_ACCESS_ERROR
, an ICU error code meaning "could not open file"Anybody know what to do here?
Ruby 1.9 has encoding built in, have you tried:
s.force_encoding 'utf-8'
mb_chars is a wrapper for ruby 1.8, so you shouldn't need it.
See duplicate