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

File test_utf16.rb added

Attachment is the fixed version of test I'd expected the behaviour.
----------------------------------------
Bug #8255: File#each_line omits last byte (==\0) if encoding is utf-16
https://bugs.ruby-lang.org/issues/8255#change-38454

Author: arton (Akio Tajima)
Status: Open
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/