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_initialize_str): /\x80/n is not an error even if script

encoding is EUC-JP.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-01-05 16:39:38 +00:00
parent 2435067f6c
commit da42c102c1
3 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sun Jan 6 01:38:07 2008 Tanaka Akira <akr@fsij.org>
* re.c (rb_reg_initialize_str): /\x80/n is not an error even if script
encoding is EUC-JP.
Sun Jan 6 00:48:12 2008 NARUSE, Yui <naruse@ruby-lang.org>
* lib/resolv.rb (Reolv::DNS#each_address): get A record and then AAAA

10
re.c
View file

@ -2035,8 +2035,14 @@ rb_reg_initialize(VALUE obj, const char *s, int len, rb_encoding *enc,
static int
rb_reg_initialize_str(VALUE obj, VALUE str, int options, onig_errmsg_buffer err)
{
return rb_reg_initialize(obj, RSTRING_PTR(str), RSTRING_LEN(str), rb_enc_get(str),
options, err);
int ret;
rb_encoding *enc = rb_enc_get(str);
if (options & ARG_ENCODING_NONE)
enc = rb_ascii8bit_encoding();
ret = rb_reg_initialize(obj, RSTRING_PTR(str), RSTRING_LEN(str), enc,
options, err);
RB_GC_GUARD(str);
return ret;
}
static VALUE

View file

@ -382,6 +382,8 @@ class TestM17N < Test::Unit::TestCase
assert_warning(%r{regexp match /.../n against to UTF-8 string}) {
assert_equal(nil, r =~ u("\xc2\xa1"))
}
assert_nothing_raised { eval(e("/\\x80/n")) }
end
def test_regexp_ascii