aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-13 23:23:43 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-13 23:38:05 +0900
commit5b1bf8dd2d08ae7371ecf025967376bb794ed651 (patch)
treef94e66f07289b3244658bddf848f65c77b115427 /io.c
parent79f9c626b63c2ce6ed1f3e767838a02a668145ba (diff)
downloadruby-5b1bf8dd2d08ae7371ecf025967376bb794ed651.tar.gz
UTF LE is fixed at least the first 2 bytes
* io.c (io_strip_bom): if the first 2 bytes are 0xFF0xFE, it should be a little-endian UTF, 16 or 32. [Bug #16099]
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/io.c b/io.c
index 69dbc93cff..6a4c5b978b 100644
--- a/io.c
+++ b/io.c
@@ -6136,12 +6136,9 @@ io_strip_bom(VALUE io)
return ENCINDEX_UTF_32LE;
}
rb_io_ungetbyte(io, b4);
- rb_io_ungetbyte(io, b3);
- }
- else {
- rb_io_ungetbyte(io, b3);
- return ENCINDEX_UTF_16LE;
}
+ rb_io_ungetbyte(io, b3);
+ return ENCINDEX_UTF_16LE;
}
rb_io_ungetbyte(io, b2);
break;