Sorry for the cross post but no takers in the Ruby forum:
Using Ruby 1.8 (for Rails 2.3.5)
I have a cvs file that was exported from an Excel file.
Some of the text contains characters like “Test in quotes” (I think
these are smart quotes)
I can properly change this to UTF-8 via:
Iconv.conv("utf-8", "cp1251", text)
Other text contains text like spanish characters like Señora. I can
properly change this to UTF-8 like this:
Iconv.conv("utf-8", "iso-8859-1", text)
However I cannot figure out how to get some text that has both types of
characters like this:
“Test in quotes” Señora
If I don''t get these properly into utf-8 they do not persist properly
in
mysql (they appear as ?)
Any ideas? Any help is greatly appreciated.
Thanks in advance.
--
Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Bump - anyone? -- Posted via http://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-/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.
On Feb 24, 8:49 am, Homer Simpson <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Sorry for the cross post but no takers in the Ruby forum: > > Using Ruby 1.8 (for Rails 2.3.5) > > I have a cvs file that was exported from an Excel file. > > Some of the text contains characters like “Test in quotes” (I think > these are smart quotes) > > I can properly change this to UTF-8 via: > > Iconv.conv("utf-8", "cp1251", text) > > Other text contains text like spanish characters like Señora. I can > properly change this to UTF-8 like this: > > Iconv.conv("utf-8", "iso-8859-1", text) > > However I cannot figure out how to get some text that has both types of > characters like this: > > “Test in quotes” Señora > > If I don''t get these properly into utf-8 they do not persist properly in > mysql (they appear as ?)You may want to try converting from Windows-1252 (not 1251), as the "smart quotes" are the same codepoints in both, but 1252 has the Spanish characters rather than the Cyrillic characters found in 1251. --Matt Jones -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Matt Jones wrote:> On Feb 24, 8:49�am, Homer Simpson <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> �Test in quotes� Se�ora >> >> If I don''t get these properly into utf-8 they do not persist properly in >> mysql (they appear as ?) > > You may want to try converting from Windows-1252 (not 1251), as the > "smart quotes" are the same codepoints in both, but 1252 has the > Spanish characters rather than the Cyrillic characters found in 1251. > > --Matt JonesThanks Matt! You are my hero :) -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.