ruby-changes:7912
From: naruse <ko1@a...>
Date: Sat, 20 Sep 2008 08:07:41 +0900 (JST)
Subject: [ruby-changes:7912] Ruby:r19433 (trunk): * re.c (rb_reg_desc): Regexps of ASCII Compatible encoding may
naruse 2008-09-20 08:07:22 +0900 (Sat, 20 Sep 2008) New Revision: 19433 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19433 Log: * re.c (rb_reg_desc): Regexps of ASCII Compatible encoding may contain non-ASCII characters. So in that case its encoding must keep original encoding. Modified files: trunk/ChangeLog trunk/re.c Index: re.c =================================================================== --- re.c (revision 19432) +++ re.c (revision 19433) @@ -380,8 +380,12 @@ rb_reg_desc(const char *s, long len, VALUE re) { VALUE str = rb_str_buf_new2("/"); - - rb_enc_associate(str, rb_usascii_encoding()); + if (rb_enc_asciicompat(rb_enc_get(re))) { + rb_enc_copy(str, re); + } + else { + rb_enc_associate(str, rb_usascii_encoding()); + } rb_reg_expr_str(str, s, len); rb_str_buf_cat2(str, "/"); if (re) { Index: ChangeLog =================================================================== --- ChangeLog (revision 19432) +++ ChangeLog (revision 19433) @@ -1,3 +1,9 @@ +Sat Sep 20 07:59:31 2008 NARUSE, Yui <naruse@r...> + + * re.c (rb_reg_desc): Regexps of ASCII Compatible encoding may + contain non-ASCII characters. So in that case its encoding + must keep original encoding. + Sat Sep 20 07:44:56 2008 NARUSE, Yui <naruse@r...> * common.mk: prec.c is removed. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/