aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-29 09:24:37 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-29 09:24:37 +0000
commit183bbd8b69077ff98c2c39f5ebc61ffe60725786 (patch)
treec15b113cf3c9066b19cb2ee0f2ad3d80785b571c /re.c
parent89f9c4144ff1ea07f3ca977e6a7336b01473e383 (diff)
downloadruby-183bbd8b69077ff98c2c39f5ebc61ffe60725786.tar.gz
Sorry, commit miss of r30412.
* re.c (rb_reg_expr_str): need to escape if the coderage is invalid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/re.c b/re.c
index 047acb62f9..2157ee8764 100644
--- a/re.c
+++ b/re.c
@@ -321,11 +321,14 @@ rb_reg_expr_str(VALUE str, const char *s, long len,
rb_encoding *enc, rb_encoding *resenc)
{
const char *p, *pend;
+ int cr = ENC_CODERANGE_UNKNOWN;
int need_escape = 0;
int c, clen;
p = s; pend = p + len;
- if (rb_enc_asciicompat(enc)) {
+ rb_str_coderange_scan_restartable(p, pend, enc, &cr);
+ if (rb_enc_asciicompat(enc) &&
+ (cr == ENC_CODERANGE_VALID || cr == ENC_CODERANGE_7BIT)) {
while (p < pend) {
c = rb_enc_ascget(p, pend, &clen, enc);
if (c == -1) {