Project

General

Profile

Backport #3633

String accessor [Fixnum, Fixnum] produces wrong result in 1.9.1

Added by minad (Daniel Mendler) almost 10 years ago. Updated 12 months ago.

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

Description

=begin
Example irb session:

irb(main):001:0> ENCODING
=> #Encoding:UTF-8
irb(main):002:0> a = "x" * 42
=> "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
irb(main):003:0> a[a.length,a.length]
=> ""
irb(main):004:0> a = "ü" * 42
=> "üüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüü"
irb(main):005:0> a[a.length,a.length]
=> "\x00\x00\x00\x00A\x00\x00\x00\x00\x00\x00\x00" <------------- What is that?

It seems that only the [Fixnum, Fixnum] accessor is affected but I will test the others too.
=end


Related issues

Is duplicate of Ruby master - Bug #2379: String#[] returns invalid values for short multibyte stringsClosednaruse (Yui NARUSE)11/18/2009Actions

Also available in: Atom PDF