In article <E1J6Vbm-0005Ms-3s / localhost>, Yukihiro Matsumoto <matz / ruby-lang.org> writes: > Very hackingly fixed, by converting RS to the external encoding. It > may not work right for some encoding, such as ISO-2022-JP though. I > will revisit the issue again, after the release. ISO-2022-JP is not required. There is a failure with EUC-JP as follows. % ./ruby -e ' r, w = IO.pipe("euc-jp:utf-8") w.write "before \xA1\xA2\xA2\xA3 after" rs = "\xA2\xA2".force_encoding("euc-jp").encode("utf-8") p r.gets(rs) ' -e:5:in `encode': illegal byte sequence (RuntimeError) from -e:5:in `gets' from -e:5:in `<main>' A terminator should be compared as characters. It is simply wrong to compare the terminator as bytes. -- Tanaka Akira