1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* re.c (rb_reg_prepare_re): show regexp encoding in the error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-24 09:38:20 +00:00
parent 96438d2bd8
commit b910bb7761
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Mon Dec 24 18:37:32 2007 Tanaka Akira <akr@fsij.org>
* re.c (rb_reg_prepare_re): show regexp encoding in the error message.
Mon Dec 24 18:23:32 2007 Tanaka Akira <akr@fsij.org>
* eval.c (rb_exc_raise): ANSI style.

5
re.c
View file

@ -945,7 +945,10 @@ rb_reg_prepare_re(VALUE re, VALUE str)
if (rb_reg_fixed_encoding_p(re)) {
if (ENCODING_GET(re) != rb_enc_get_index(str) &&
rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) {
rb_raise(rb_eArgError, "fixed character encoding regexp with incompatible string (encoding: %s)", rb_enc_name(rb_enc_get(str)));
rb_raise(rb_eArgError,
"incompatible encoding regexp match (%s regexp with %s string)",
rb_enc_name(rb_enc_from_index(ENCODING_GET(re))),
rb_enc_name(rb_enc_get(str)));
}
}
else {