summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-18 06:53:02 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-18 06:53:02 +0000
commit1ea42115afaeba2aad4bbe8567be4b938c499d31 (patch)
treef9e67d15afb00b2aff84c6aee21d2c277dba49b1 /io.c
parente1d3b318fb3ac090aa72619ec649d875d05ede08 (diff)
merge revision(s) 5b1bf8dd2d08ae7371ecf025967376bb794ed651: [Backport #16099]
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 e581145564..94e425a277 100644
--- a/io.c
+++ b/io.c
@@ -6129,12 +6129,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;