mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 10:03:59 +02:00
* encoding.c (rb_enc_compatible): If a string is empty and
other's encoding is US-ASCII, returns the empty string's encoding. [ruby-list:46274] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8b83fc2704
commit
e666111955
3 changed files with 10 additions and 2 deletions
|
@ -7,6 +7,7 @@ class TestM17N < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
module AESU
|
||||
def ua(str) str.dup.force_encoding("US-ASCII") end
|
||||
def a(str) str.dup.force_encoding("ASCII-8BIT") end
|
||||
def e(str) str.dup.force_encoding("EUC-JP") end
|
||||
def s(str) str.dup.force_encoding("Windows-31J") end
|
||||
|
@ -1300,6 +1301,7 @@ class TestM17N < Test::Unit::TestCase
|
|||
|
||||
def test_compatible
|
||||
assert_nil Encoding.compatible?("",0)
|
||||
assert_equal(Encoding::UTF_8, Encoding.compatible?(u(""), ua("abc")))
|
||||
assert_equal(Encoding::UTF_8, Encoding.compatible?(Encoding::UTF_8, Encoding::UTF_8))
|
||||
assert_equal(Encoding::UTF_8, Encoding.compatible?(Encoding::UTF_8, Encoding::US_ASCII))
|
||||
assert_equal(Encoding::ASCII_8BIT,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue