[ruby-core:64049] [ruby-trunk - Bug #10097] [Open] Case-insensitive Regexp matching for Windows-1252 not working for ŠšŽžŒœÿŸ

From: duerst@...
Date: 2014-07-26 09:43:02 UTC
List: ruby-core #64049
Issue #10097 has been reported by Martin D=C3=BCrst.

----------------------------------------
Bug #10097: Case-insensitive Regexp matching for Windows-1252 not working f=
or =C5=A0=C5=A1=C5=BD=C5=BE=C5=92=C5=93=C3=BF=C5=B8
https://bugs.ruby-lang.org/issues/10097

* Author: Martin D=C3=BCrst
* Status: Open
* Priority: Normal
* Assignee:=20
* Category:=20
* Target version:=20
* ruby -v: 1.9.3p545
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
By chance I had a look at enc/iso_8859_1.c and found
   ENC_REPLICATE("Windows-1252", "ISO-8859-1")
on line 288. But this does not work for case folding:

# http://en.wikipedia.org/wiki/Windows-1252
s1 =3D "\u0160".encode 'windows-1252' # '=C5=A0'
r1 =3D Regexp.new("\u0161".encode('windows-1252'), Regexp::IGNORECASE) # /=
=C5=A1/i
s1 =3D~ r1
   # =3D> nil
s2 =3D "\u0178".encode 'windows-1252' # '=C5=B8'
r2 =3D Regexp.new("\u00FF".encode('windows-1252'), Regexp::IGNORECASE) # /=
=C3=BF/i
s2 =3D~ r2
   # =3D> nil
s3 =3D "\u00C0".encode 'windows-1252' # '=C3=80'
r3 =3D Regexp.new("\u00E0".encode('windows-1252'), Regexp::IGNORECASE) # /=
=C3=A0/i
s3 =3D~ r3
   # =3D> 0

So case-insensitive matching works when both characters are in iso-8859-1, =
but not when one (=C3=BF=C5=B8) or both (=C5=A0=C5=A1=C5=BD=C5=BE=C5=92=C5=
=93) characters are not in iso-8859-1.



--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next