Project

General

Profile

Bug #9903

Regexp#[] doesn't consider capture name encoding

Added by nobu (Nobuyoshi Nakada) almost 4 years ago. Updated over 3 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"

Associated revisions

Revision 5861d4f1
Added by nobu (Nobuyoshi Nakada) almost 4 years ago

re.c: consider name encoding

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 46346
Added by nobu (Nobuyoshi Nakada) almost 4 years ago

re.c: consider name encoding

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

Revision 46346
Added by nobu (Nobuyoshi Nakada) almost 4 years ago

re.c: consider name encoding

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

Revision 46346
Added by nobu (Nobuyoshi Nakada) almost 4 years ago

re.c: consider name encoding

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

Revision 46346
Added by nobu (Nobuyoshi Nakada) almost 4 years ago

re.c: consider name encoding

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

Revision 46346
Added by nobu (Nobuyoshi Nakada) almost 4 years ago

re.c: consider name encoding

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

Revision 3aefb61f
Added by nagachika (Tomoyuki Chikanaga) almost 4 years ago

merge revision(s) r46345,r46346: [Backport #9903]

re.c: reduce new strings

* re.c (match_aref, rb_reg_regsub): reduce new strings creation

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 47052
Added by nagachika (Tomoyuki Chikanaga) almost 4 years ago

merge revision(s) r46345,r46346: [Backport #9903]

re.c: reduce new strings

* re.c (match_aref, rb_reg_regsub): reduce new strings creation

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

Revision d910ce1f
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 42251,46345,46346: [Backport #9903]

* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
  characters.

* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
  characters.

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 47364
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 42251,46345,46346: [Backport #9903]

* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
  characters.

* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
  characters.

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

History

#1 [ruby-dev:48279] Updated by nobu (Nobuyoshi Nakada) almost 4 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. [Bug #9903]

#2 [ruby-dev:48460] Updated by nagachika (Tomoyuki Chikanaga) almost 4 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.

#3 [ruby-dev:48512] Updated by usa (Usaku NAKAMURA) over 3 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.

Also available in: Atom PDF