diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-05 16:39:38 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-05 16:39:38 +0000 |
| commit | 38f566c7e8be6cbbc789ce8d460addee1640bce9 (patch) | |
| tree | f9d898bc07fb54817bb98979b41ee96664a3ca87 | |
| parent | e6b9da345fc86af1b62ee279538ef79ad6477b5c (diff) | |
| download | ruby-38f566c7e8be6cbbc789ce8d460addee1640bce9.tar.gz ruby-38f566c7e8be6cbbc789ce8d460addee1640bce9.tar.xz ruby-38f566c7e8be6cbbc789ce8d460addee1640bce9.zip | |
* re.c (rb_reg_initialize_str): /\x80/n is not an error even if script
encoding is EUC-JP.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | re.c | 10 | ||||
| -rw-r--r-- | test/ruby/test_m17n.rb | 2 |
3 files changed, 15 insertions, 2 deletions
@@ -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 @@ -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 diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 28db8377b..daa8af7fc 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -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 |
