Project

General

Profile

Actions

Bug #6167

closed

String#count: wrong result for multiple complements of multi-byte characters

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

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
Backport:
[ruby-core:43371]

Description

"\u0100\u0101".count("^\u0100", "^\u0101")
=> 2

Since multiple arguments are intersected, the expected result is 0. Compare:

"\u0080\u0081".count("^\u0080", "^\u0081")
=> 0

This takes a different path through tr_setup_table and returns the correct result.

Analogous bugs exists in String#squeeze and String#delete, which also use tr_setup_table.

Actions

Also available in: Atom PDF

Like0
Like0Like0