Project

General

Profile

Actions

Bug #11488

closed

String#index and #include? broken for wide encodings

Added by tomstuart (Tom Stuart) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
[ruby-core:<unknown>]

Description

In Ruby 2.2.2, String#index and #include? work as expected for all encodings:

>> Encoding.list.reject(&:dummy?).
     reject { |e| 'abcdef'.encode(e).include?('def'.encode(e)) }.
     map(&:name)
=> []

But in Ruby 2.2.3 and trunk, they have become broken for wide encodings:

>> Encoding.list.reject(&:dummy?).
     reject { |e| 'abcdef'.encode(e).include?('def'.encode(e)) }.
     map(&:name)
=> ["UTF-16BE", "UTF-16LE", "UTF-32BE", "UTF-32LE"]

This broke as a result of revision 51470 (trunk) / 51590 (2.2.3). I attach a test.


Files

string-index-include-wide-bug.patch (1.18 KB) string-index-include-wide-bug.patch tomstuart (Tom Stuart), 08/25/2015 04:07 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #11413: String#split with wchar stringClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0