char-class matching same character with different encodings raises exception
The following simple script illustrates the issue:
ESCAPE_PLAIN = /\A[\x5B]*\z/m.freeze 0x5B.chr(::Encoding::UTF_8) =~ ESCAPE_PLAIN 0x5B.chr =~ ESCAPE_PLAIN
']', run all lines above and get in `=~': empty char-class: /\A[\x5B]*\z/m (RegexpError)
Comment out either the first or second usage and the error goes away.
Updated by nobu (Nobuyoshi Nakada) over 5 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r49058.
re.c: append excape sequence as-is
- re.c (unescape_nonascii): append excape sequence as-is not unescaped character, to get rid of unexpected meta-character. [ruby-core:67193] [Bug #10670]