This confirms my original suspicion; your file is almost certainly in
either ISO8859-1 or Windows-1252. The accented characters are being
misread, as Ruby's default value (or maybe Rails?) is $KCODE = 'u'. So
the accented letters are interpreted as the first character of a 3-
byte UTF-8 sequence.

You might want to try passing the :encoding => 'n' option to FasterCSV
and see what that does; getting Windows-1252 characters to display
correctly on other platforms is left as an exercise.. :)

--Matt Jones

On Jun 21, 7:52 pm, Hu Ma <rails-mailing-l...@andreas-s.net> wrote:
> Hello all,
>
> I've update to Rails 2.3.2 and the problem remains.
> I've also created a new application, and added just one controller
> and FasterCSV to environment.rb (no other plugins are present in the
> application) but still it does not work.
>
> I already said here that the error only happens in rails. I also found
> out the following weird behavior: this error only happens if the latin
> character is in the last two positions in the string.
> Example 1 (Not working):
> "1","Maria José",,"9"
> Example 2 (Not working):
> "1","Helder Serrão",,"9"
> Example 3 (working):
> "2","José Maria",,"10"
>
> Also I checked that it works if the latin caracters exist only in the
> last column:
> Example 4 (working):
> "1","9",,"Maria José"
>
> Note: I've removed the KCODE part from the code.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to