summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 07:37:02 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 07:37:02 +0000
commit00499c097f0d62a0389d006b61d766cef0ba14ff (patch)
tree596ab8dc5d853ae3bb204b8ac539e247d337d574
parentbc70ea70cd455261d185ec386e4c04ce9ccabf62 (diff)
Set encodings of stdio after setting default internal and external.
* io.c (rb_stdio_set_default_encoding): added. * ruby.c (process_options): call rb_stdio_set_default_encoding after setting defualt internal and external. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--io.c11
-rw-r--r--ruby.c1
3 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 503a24fc175..de5d713840c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jul 31 16:28:33 2009 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_stdio_set_default_encoding): added.
+
+ * ruby.c (process_options): call rb_stdio_set_default_encoding
+ after setting defualt internal and external.
+
Fri Jul 31 15:06:33 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* tool/compile_prelude.rb: too long string literal causes compile error
diff --git a/io.c b/io.c
index fd0552b237e..3153ff7c23e 100644
--- a/io.c
+++ b/io.c
@@ -8407,6 +8407,17 @@ rb_io_set_encoding(int argc, VALUE *argv, VALUE io)
return io;
}
+void
+rb_stdio_set_default_encoding()
+{
+ extern VALUE rb_stdin, rb_stdout, rb_stderr;
+ VALUE val = Qnil;
+
+ rb_io_set_encoding(1, &val, rb_stdin);
+ rb_io_set_encoding(1, &val, rb_stdout);
+ rb_io_set_encoding(1, &val, rb_stderr);
+}
+
static VALUE
argf_external_encoding(VALUE argf)
{
diff --git a/ruby.c b/ruby.c
index 180455e92d6..6839bfe3231 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1399,6 +1399,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
else if (!rb_default_internal_encoding())
/* Freeze default_internal */
rb_enc_set_default_internal(Qnil);
+ rb_stdio_set_default_encoding();
if (!tree) return Qfalse;