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

From: usa@...
Date: 2014-09-03 03:29:37 UTC
List: ruby-dev #48512
Issue #9903 has been updated by Usaku NAKAMURA.

Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

backported into `ruby_2_0_0` at r47364.

note that it needed r42251.

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

* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee:=20
* Category:=20
* Target version:=20
* ruby -v: r46343
* Backport: 2.0.0: DONE, 2.1: DONE
----------------------------------------
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