Read UTF-8 file

I

Imre

Hi

I'm new to Ruby, so this might be a lame question, but googling
around, I couldn't find an easy answer.
So, how do I read a UTF-8 file?
Basically I just want to read a UTF-8 text file line by line, and
filter out some of the lines that match a regexp. Simply using
File.foreach doesn't seem to work because of some special characters
(like 0x1a / ^Z), where writing out the line that were just read in
doesn't give the same result as the original was.
Thanks for any help.

Imre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top