Project

General

Profile

Bug #1839

String#tr borked for UTF-8 0080..00FF

Added by candlerb (Brian Candler) over 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
Backport:
[ruby-core:24612]

Description

=begin

a = "uber"
=> "uber"
a.encoding
=> #Encoding:UTF-8
b = a.tr("u","ü")
=> "\xFCber"
b.encoding
=> #Encoding:UTF-8

What's more remarkable,

b.valid_encoding?
=> true

!!!

b << "x"
=> "\xFCberx"
b.valid_encoding?
=> true

!!!

And yet it works for codepoints > 255:

c = a.tr("u","ł")
=> "łber"
c.encoding
=> #Encoding:UTF-8

=end

History

#1

Updated by candlerb (Brian Candler) over 10 years ago

=begin
Oops, I pasted ruby -v instead of ruby19 -v. The correct version is:

ruby 1.9.2dev (2009-07-18 trunk 24186) [i686-linux]

=end

#2

Updated by naruse (Yui NARUSE) over 10 years ago

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

=begin
Applied in changeset r24342.
=end

Also available in: Atom PDF