[ruby-dev:48279] [ruby-trunk - Bug #9903] [Closed] Regexp#[] doesn't consider capture name encoding

From: nobu@...
Date: 2014-06-04 13:10:05 UTC
List: ruby-dev #48279
Issue #9903 has been updated by Nobuyoshi Nakada.

Status changed from Open to Closed
% Done changed from 0 to 100

Applied in changeset r46346.

----------
re.c: consider name encoding

* re.c (match_aref, rb_reg_regsub): consider encoding of captured
  names, encoding-incompatible should not match.
  [ruby-dev:48278] [Bug #9903]

----------------------------------------
Bug #9903: Regexp#[] doesn't consider capture name encoding
https://bugs.ruby-lang.org/issues/9903#change-47038

* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee:=20
* Category:=20
* Target version:=20
* ruby -v: r46343
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
Regexp#[]=E3=81=8C=E5=BC=95=E6=95=B0=E3=81=AE=E6=96=87=E5=AD=97=E5=88=97=E3=
=82=84=E3=82=B7=E3=83=B3=E3=83=9C=E3=83=AB=E3=82=92=E8=80=83=E6=85=AE=E3=81=
=97=E3=81=A6=E3=81=84=E3=81=BE=E3=81=9B=E3=82=93=E3=80=82

~~~ruby
key =3D "\xb1\xb2".force_encoding(Encoding::EUC_JP)
m =3D /(?<#{key}>.*)/.match("xxx")
p m[key.dup.force_encoding(Encoding::Shift_JIS)]
# =3D> "xxx"
~~~



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

In This Thread

Prev Next