Thanks for the help Ara, I guess I just didn't understand the file operations. Now I will look to solve saving ö Ĉ or 0xF6 as an actual "ö¢ into a text file. I can't seem to get unpack to convert "=264" into "ö¢. Any ideas On Tue, 2003-02-18 at 19:08, ahoward wrote: > On Wed, 19 Feb 2003, William Tihen wrote: > > > 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öî > > > <snip> > > seems to work : > > /tmp > ruby -e "f = File.open 'foo', 'w'; f.puts 'Döî'" > > /tmp > cat foo > Döî > > /tmp > ruby -e "puts (IO.readlines 'foo')" > Döî > > /tmp > ruby -e "lines = IO.readlines 'foo'; f = File.open 'foo', 'w'; f.puts lines" > > /tmp > cat foo > Döî > > are you in dos? perhaps trying IO.binmode will help then... > > when you say > > > I get: > > D\366n > > > > If I save this and read it in again I get: > > D\\366n > > i assume you mean in irb? if so, this is simply because the display method of > strings displays (and other extended chars) as their octal escaped equivs - > the byte value in the file is still the same, which you can see using cat or > opening the file from a test editor. > > -a > > -- > > ==================================== > | Ara Howard > | NOAA Forecast Systems Laboratory > | Information and Technology Services > | Data Systems Group > | R/FST 325 Broadway > | Boulder, CO 80305-3328 > | Email: ahoward / fsl.noaa.gov > | Phone: 303-497-7238 > | Fax: 303-497-7259 > ==================================== >