Project

General

Profile

Actions

Bug #9903

closed

Regexp#[] doesn't consider capture name encoding

Added by nobu (Nobuyoshi Nakada) about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
r46343
[ruby-dev:48278]

Description

Regexp#[]が引数の文字列やシンボルを考慮していません。

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

Also available in: Atom PDF