ruby-changes:2804
From: ko1@a...
Date: 18 Dec 2007 19:02:53 +0900
Subject: [ruby-changes:2804] matz - Ruby:r14295 (trunk): * string.c (rb_str_splice): propagate encoding.
matz 2007-12-18 18:14:46 +0900 (Tue, 18 Dec 2007) New Revision: 14295 Modified files: trunk/ChangeLog trunk/string.c Log: * string.c (rb_str_splice): propagate encoding. * string.c (rb_str_subpat_set): ditto. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=14295&r2=14294 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14295&r2=14294 Index: ChangeLog =================================================================== --- ChangeLog (revision 14294) +++ ChangeLog (revision 14295) @@ -1,3 +1,9 @@ +Tue Dec 18 18:09:15 2007 Yukihiro Matsumoto <matz@r...> + + * string.c (rb_str_splice): propagate encoding. + + * string.c (rb_str_subpat_set): ditto. + Tue Dec 18 17:27:12 2007 Yukihiro Matsumoto <matz@r...> * object.c (rb_obj_freeze): preserve frozen state of immediate Index: string.c =================================================================== --- string.c (revision 14294) +++ string.c (revision 14295) @@ -2142,6 +2142,7 @@ beg = p - RSTRING_PTR(str); /* physical position */ len = e - p; /* physical length */ rb_str_splice_0(str, beg, len, val); + rb_enc_associate(str, enc); } void @@ -2155,6 +2156,7 @@ { VALUE match; long start, end, len; + rb_encoding *enc; if (rb_reg_search(re, str, 0, 0) < 0) { rb_raise(rb_eIndexError, "regexp not matched"); @@ -2178,8 +2180,9 @@ end = RMATCH(match)->END(nth); len = end - start; StringValue(val); - rb_enc_check(str, val); + enc = rb_enc_check(str, val); rb_str_splice_0(str, start, len, val); + rb_enc_associate(str, enc); } static VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml