Project

General

Profile

Actions

Backport #6153

closed

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

Added by john_firebaugh (John Firebaugh) about 12 years ago. Updated about 12 years ago.

Status:
Closed
[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?

Actions #1

Updated by nobu (Nobuyoshi Nakada) about 12 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)
Actions #2

Updated by naruse (Yui NARUSE) about 12 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0