Jeff Pritchard
2009-Jan-16 07:06 UTC
importing text files - file type (UTF-16 for instance)
Hi, I''m using the iFrame and responds_to_parent method to import some text files (csv files) from various sources. Some of the files of interest are in UTF-8 or UTF-16 format. How can my code determine what the file type is of an imported file? How can I convert a file from UTF-16 to a 7 or 8 bit file (for now at least, I''m not required to deal with languages that actually need 16 bits.) GMail, for instance, exports UTF-16 files, even if the contents are all English or other 8 bit languages. So when I import one, I get alternating ascii chars and diamond with a question mark in the middle chars (I assume that''s how my Mac displays an ascii NULL. I suppose I could snoop the type from the gathered data by looking for the alternating null chars, but that seems really cheesy. thanks! jp -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---