Project

General

Profile

Backport #6153

inconsistent encoding for result of String#<< vs #+

Added by john_firebaugh (John Firebaugh) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:43317]

Description

Encoding.compatible?("abc".encode("ASCII-8BIT"), "123".encode("ASCII-8BIT"))
=> #Encoding:ASCII-8BIT
("abc".encode("ASCII-8BIT") << "123".encode("US-ASCII")).encoding
=> #Encoding:ASCII-8BIT
("abc".encode("ASCII-8BIT").concat "123".encode("US-ASCII")).encoding
=> #Encoding:ASCII-8BIT
("abc".encode("ASCII-8BIT") + "123".encode("US-ASCII")).encoding
=> #Encoding:US-ASCII

Is there a reason why the last example doesn't return ASCII-8BIT as well?

Associated revisions

Revision 58f269d0
Added by naruse (Yui NARUSE) over 7 years ago

merge revision(s) 34433: [Backport #6153]

  • encoding.c (rb_enc_compatible): return ASCII-8BIT even if 2nd string is ascii only string. [ruby-core:42354] [Bug #5968]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 35078
Added by naruse (Yui NARUSE) over 7 years ago

merge revision(s) 34433: [Backport #6153]

  • encoding.c (rb_enc_compatible): return ASCII-8BIT even if 2nd string is ascii only string. [ruby-core:42354] [Bug #5968]

History

#1

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193
  • Status changed from Open to Assigned
  • Assignee set to naruse (Yui NARUSE)
#2

Updated by naruse (Yui NARUSE) over 7 years ago

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

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


merge revision(s) 34433: [Backport #6153]

  • encoding.c (rb_enc_compatible): return ASCII-8BIT even if 2nd string is ascii only string. [ruby-core:42354] [Bug #5968]

Also available in: Atom PDF