diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-07 15:31:42 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-07 15:31:42 +0000 |
commit | bdd97e5f38d6ef876a1ed1206f0d7ba3e7da9983 (patch) | |
tree | 90195adbf7039010c1df42e0da83c15afa843ff0 /test | |
parent | 7bd41bd2cae0435301b46d845986c1410bbc8323 (diff) |
merge revision(s) 67167: [Backport #15635]
string.c: respect the actual encoding
* string.c (rb_enc_str_coderange): respect the actual encoding of
if a BOM presents, and scan for the actual code range.
[ruby-core:91662] [Bug #15635]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_m17n.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index e2c0b7633a..9c7df4cb03 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -269,6 +269,13 @@ class TestM17N < Test::Unit::TestCase assert_empty(encs, bug10598) end + def test_utf_without_bom_valid + encs = [Encoding::UTF_16, Encoding::UTF_32].find_all {|enc| + !(+"abcd").encode!(enc).force_encoding(enc).valid_encoding? + } + assert_empty(encs) + end + def test_object_utf16_32_inspect EnvUtil.suppress_warning do begin |