Issue #16099 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.5: REQUIRED, 2.6: DONE to 2.5: DONE, 2.6: DONE

ruby_2_5 r67772 merged revision(s) 5b1bf8dd2d08ae7371ecf025967376bb794ed651.

----------------------------------------
Bug #16099: UTF-16LE BOM followed by '\0' is missed
https://bugs.ruby-lang.org/issues/16099#change-81039

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: 
* Backport: 2.5: DONE, 2.6: DONE
----------------------------------------
```
$ ruby -e 'File.binwrite("u.txt", "\xff\xfe\x00\x01")'
$ file u.txt 
u.txt: Little-endian UTF-16 Unicode text, with no line terminators
$ ruby -e 'p File.open("u.txt", "rb:bom|utf-8", &:external_encoding)'
#<Encoding:UTF-8>
```

The last result must be UTF-16LE.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>