Project

General

Profile

This project is closed and read-only.

Actions

Backport #5379

closed

the join method of array return different encoding result

Backport #5379: the join method of array return different encoding result

Added by saberma (saber ma) almost 15 years ago. Updated almost 15 years ago.

Status:
Closed
[ruby-core:39776]

Description

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
=> "\xE4\xB8\xAD\xE6\x96\x87"

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) almost 15 years ago Actions #1

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r33363.
saber, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • array.c (ary_join_1): should not copy the encoding of non-string
    element after string element. [ruby-core:39776] [Bug #5379]

Updated by nobu (Nobuyoshi Nakada) almost 15 years ago Actions #2

  • Tracker changed from Bug to Backport
  • Project changed from Ruby to 13
  • Status changed from Closed to Assigned
  • Assignee set to yugui (Yuki Sonoda)
  • Target version deleted (1.9.3)

Updated by naruse (Yui NARUSE) almost 15 years ago Actions #3 [ruby-core:39782]

Please backport it with r33364.

Updated by kosaki (Motohiro KOSAKI) almost 15 years ago Actions #4

  • 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]

Updated by kosaki (Motohiro KOSAKI) almost 15 years ago Actions #5 [ruby-core:40052]

OK, this is regression.
r33436 and r33437.

Actions

Also available in: PDF Atom