the join method of array return different encoding result
ruby-1.9.3-rc1 :001 > [, "中文"].join
This is fine. But is the last element is nil, the result is different.
ruby-1.9.3-rc1 :002 > [, "中文", nil].join
It will cause some gems to raise error: incompatible character encodings: UTF-8 and US-ASCII
This bug can be reproduct in ruby1.9.3 preview1 and rc1, but ruby1.9.2 p180 and p290 is ok.
ruby-1.9.2-p180 :001 > [, "中文",nil].join
ruby-1.9.2-p180 :002 > [, "中文"].join
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Updated by kosaki (Motohiro KOSAKI) over 10 years ago
- Status changed from Assigned to Closed
This issue was solved with changeset r33436.
saber, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 33363:
* array.c (ary_join_1): should not copy the encoding of non-string element after string element. [ruby-core:39776] [Bug #5379]