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

From: nagachika00@...
Date: 2014-08-03 16:21:19 UTC
List: ruby-dev #48460
Issue #9903 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.=
1: DONE

Backported into `ruby_2_1` branch at r47052.

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

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