summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-21 07:02:55 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-21 07:02:55 +0000
commite48ea0a5f330ce694e5d6e28a3b4825be13910df (patch)
tree623f37d5acf019af9868527458fb0de57e639f66 /numeric.c
parent12df6cf7cece79a1d5d99037b35b6a28c3c3296c (diff)
* io.c (rb_io_s_read): allow specifying encoding explicitly.
* io.c (rb_io_binmode): specifies encoding to ASCII-8BIT (binary). * io.c (rb_io_s_read): IO should be in binary mode when offset is specified. * encoding.c (rb_to_encoding): returns default encoding if no corresponding encoding found. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index 7c78767487..45a9ce025e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1860,6 +1860,7 @@ int_chr(int argc, VALUE *argv, VALUE num)
break;
}
enc = rb_to_encoding(argv[0]);
+ if (!enc) enc = rb_default_encoding();
if (i < 0 || (n = rb_enc_codelen(i, enc)) <= 0) goto out_of_range;
str = rb_enc_str_new(0, n, enc);
rb_enc_mbcput(i, RSTRING_PTR(str), enc);