In article <476C505A.9020706 / davidflanagan.com>, David Flanagan <david / davidflanagan.com> writes: > The attached patch adds support for filemodes like "r:utf-8:iso-8859-15" > to io.c. Works for reading and writing. Also, it adds the The conversion should be done before searching a terminator. % ./ruby -ve ' open("tmp", "w") {|f| f.write "a\u00FFb" } s = open("tmp", "r:iso-8859-1:utf-8") {|f| f.gets("\xFF".force_encoding("iso-8859-1")) } puts s.dump ' ruby 1.9.0 (2007-12-23 patchlevel 0) [i686-linux] "a\xFFb" IO#gets should search LATIN SMALL LETTER Y WITH DIAERESIS (0xff in ISO-8859-1). But the result is not terminated by the character. -- Tanaka Akira