Skip to content

Commit

Permalink
* marshal.c (r_object0): set encoding only if the encoding is not US-…
Browse files Browse the repository at this point in the history
…ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nurse committed Jul 10, 2009
1 parent 234485d commit 143d1d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Fri Jul 10 14:41:34 2009 NARUSE, Yui <[email protected]>

* marshal.c (r_object0): set encoding only if the encoding
is not US-ASCII.
Fri Jul 10 14:44:03 2009 Nobuyoshi Nakada <[email protected]>

* random.c (struct MT): ruby already assumes int has 32bit a
Expand Down
3 changes: 2 additions & 1 deletion marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,8 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
r_ivar(v, arg);
*ivp = Qfalse;
}
rb_enc_copy(str, v);
if (rb_enc_get_index(v) != rb_usascii_encindex())
rb_enc_copy(str, v);
if (rb_enc_get_index(str) != rb_utf8_encindex()) {
#define f_gsub_bang(x,y,z) rb_funcall(x, rb_intern("gsub!"), 2, y, z)
f_gsub_bang(str, rb_reg_new("\\\\u", 3, 0), rb_usascii_str_new_cstr("u"));
Expand Down

0 comments on commit 143d1d8

Please sign in to comment.