From: William Tihen Date: 2003-02-19T02:09:52+09:00 Subject: Reading Text files with extended ASCII characters Hello, I have reviewed the mailing list ruby-talk and I found some interesting stuff, but I haven't seen the answer to reading (and creating) text files with extended ASCII characters. For example when I try to read a text file with the word: D�n I get: D\366n If I save this and read it in again I get: D\\366n Oddly many normal punctuation characters are also exscaped, these include (at least): " # I assume I am reading the text file incorrectly or not converting it to something because when I read a line of a file I also get: "what-ever-it-says\n" I am reading and writing the file with the following commands: File.delete ("fileout.html") if FileTest.exist?("fileout.html") File.open ('filein.html', "r") do |f_in| f_in.each_line do |line| reformated = line.dump reformated = line.sub ( /"(.*)\\n"/,'\1') reformated = line.gsub (/\\([#"])/, '\1') File.open ("fileout.html","a") {|f_out|f_out.print reformated } end end Is there a convient way to keep the extened ASCII characters (or convert them to ö and is there a convient way to convert this ö and convert it into an "�" and save it into a text file? I look forward to guidance. Thanks, Bill -- William H. Tihen, Technology Director The American School in Switzerland (TASIS) tihen.william@tasis.ch http://www.tasis.ch/