Hi,
In order to solve this issue, I use the chardet gem
https://rubygems.org/gems/chardet to identify the file encoding and then I
iconv it to utf-8.
Mickael
On 23 January 2011 22:21, Garrett Lancaster
<glancast-jmyiO2ngOJdad6c/EObmYVaTQe2KTcn/@public.gmane.org>wrote:
> I''m writing an upload script for contact management, but having
encoding
> issues:
>
> #=> Encoding::UndefinedConversionError: "\xFA" from ASCII-8BIT
to UTF-8
>
> I will not always know the encoding supplied, and this is the result of
> `some_string.encode("UTF-8")`
>
> I have also tried .force_encoding("UTF-8") to no avail. For now
I''m simply
> trying to bypass invalid characters by replacing them with ? or removing
> them completely so Postgres doesn''t blow up on insert.
>
> Any help or advice would be appreciated,
> Garrett Lancaster
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.