Project

General

Profile

Actions

Backport #3633

closed

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

Added by Anonymous over 14 years ago. Updated over 5 years ago.

Status:
Closed
[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 1 (0 open1 closed)

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

Also available in: Atom PDF

Like0
Like0Like0