Issue #8255 has been updated by arton (Akio Tajima).

Status changed from Open to Closed

Sorry, I've only changed 'rb:utf-16le' when I wrote above comments.
It's running fine if I chaned 'wb:utf-16le' when writing out the file.
----------------------------------------
Bug #8255: File#each_line omits last byte (==\0) if encoding is utf-16
https://bugs.ruby-lang.org/issues/8255#change-38455

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/