From: "naruse (Yui NARUSE)" Date: 2013-04-12T01:52:58+09:00 Subject: [ruby-core:54186] [ruby-trunk - Bug #8255] File#each_line omits last byte (==\0) if encoding is utf-16 Issue #8255 has been updated by naruse (Yui NARUSE). Just FYI, you can propose transparent treatment along UTF-16 series ;-) ---------------------------------------- Bug #8255: File#each_line omits last byte (==\0) if encoding is utf-16 https://bugs.ruby-lang.org/issues/8255#change-38458 Author: arton (Akio Tajima) Status: Closed Priority: Normal Assignee: Category: Target version: current: 2.1.0 ruby -v: ruby 2.1.0dev (2013-04-11) [i386-mswin32_100] If File#each_line was given utf-16 encoded file with 'rb:utf-16', each line lacks the last one byte. For example if the line is "a\0\r\0\n\0" in binary, the read line contains "a\0\r\0\r". See the attchement. This issue is appear both current 2.1.0 and 2.0.0. -- http://bugs.ruby-lang.org/