mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 10:33:58 +02:00
* array.c (array_join): copy the encoding of the first element as
an initial encoding. * array.c (array_join_0): ditto. * array.c (array_join_1): ditto. * array.c (inspect_ary): ditto. * array.c (array_join_1): add an argument to check the appending is first one or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7798b9667e
commit
c7d3b3f1b4
3 changed files with 37 additions and 4 deletions
|
@ -914,6 +914,13 @@ class TestArray < Test::Unit::TestCase
|
|||
s = a.join
|
||||
assert_equal(true, s.tainted?)
|
||||
assert_equal(true, s.untrusted?)
|
||||
|
||||
e = ''.force_encoding('EUC-JP')
|
||||
u = ''.force_encoding('UTF-8')
|
||||
assert_equal(Encoding::US_ASCII, [[]].join.encoding)
|
||||
assert_equal(Encoding::US_ASCII, [1, [u]].join.encoding)
|
||||
assert_equal(Encoding::UTF_8, [u, [e]].join.encoding)
|
||||
assert_equal(Encoding::UTF_8, [u, [1]].join.encoding)
|
||||
ensure
|
||||
$, = nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue