Actions
Bug #9903
closedRegexp#[] doesn't consider capture name encoding
Description
Regexp#[]が引数の文字列やシンボルを考慮していません。
key = "\xb1\xb2".force_encoding(Encoding::EUC_JP)
m = /(?<#{key}>.*)/.match("xxx")
p m[key.dup.force_encoding(Encoding::Shift_JIS)]
# => "xxx"
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- 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]
Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago
- 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.
Updated by usa (Usaku NAKAMURA) about 10 years ago
- 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.
Actions
Like0
Like0Like0Like0