* re.c (rb_reg_desc): set encoding.
* re.c (rb_reg_s_union): check encodings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
59609a4fba
commit
b06a606278
@ -1,4 +1,8 @@
|
|||||||
Wed Oct 17 03:06:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Oct 17 03:37:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* re.c (rb_reg_desc): set encoding.
|
||||||
|
|
||||||
|
* re.c (rb_reg_s_union): check encodings.
|
||||||
|
|
||||||
* enc/utf8.c (utf8_code_to_mbclen): 0xfe and 0xff are valid Unicode to
|
* enc/utf8.c (utf8_code_to_mbclen): 0xfe and 0xff are valid Unicode to
|
||||||
be encoded to 2bytes in UTF-8. [ruby-core:12700]
|
be encoded to 2bytes in UTF-8. [ruby-core:12700]
|
||||||
|
3
re.c
3
re.c
@ -266,6 +266,7 @@ rb_reg_desc(const char *s, long len, VALUE re)
|
|||||||
{
|
{
|
||||||
VALUE str = rb_str_buf_new2("/");
|
VALUE str = rb_str_buf_new2("/");
|
||||||
|
|
||||||
|
rb_enc_copy(str, re);
|
||||||
rb_reg_expr_str(str, s, len);
|
rb_reg_expr_str(str, s, len);
|
||||||
rb_str_buf_cat2(str, "/");
|
rb_str_buf_cat2(str, "/");
|
||||||
if (re) {
|
if (re) {
|
||||||
@ -1798,7 +1799,7 @@ rb_reg_s_union(VALUE self, VALUE args0)
|
|||||||
rb_enc_check(tmp, e);
|
rb_enc_check(tmp, e);
|
||||||
v = rb_reg_s_quote(Qnil, e);
|
v = rb_reg_s_quote(Qnil, e);
|
||||||
}
|
}
|
||||||
rb_str_buf_append(source, v);
|
rb_str_append(source, v);
|
||||||
}
|
}
|
||||||
return rb_class_new_instance(1, &source, rb_cRegexp);
|
return rb_class_new_instance(1, &source, rb_cRegexp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user