From a9246704b145d362f644c9cc262d20d6c2dba990 Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 8 Aug 2009 15:31:15 +0000 Subject: merges r24337 from trunk into ruby_1_9_1. -- 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@24456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ io.c | 11 +++++++++++ ruby.c | 1 + version.h | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7daa4d1df..6e2cad344 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Jul 31 16:28:33 2009 NARUSE, Yui + + * 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 18:01:34 2009 NAKAMURA Usaku * lib/securerandom.rb (SecureRandom.random_bytes): return string should diff --git a/io.c b/io.c index 9ed097777..bf10a31d5 100644 --- a/io.c +++ b/io.c @@ -7948,6 +7948,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 c6cfdf7e1..68d8f97a4 100644 --- a/ruby.c +++ b/ruby.c @@ -1370,6 +1370,7 @@ process_options(VALUE arg) else if (!rb_default_internal_encoding()) /* Freeze default_internal */ rb_enc_set_default_internal(Qnil); + rb_stdio_set_default_encoding(); if (!tree) return Qfalse; diff --git a/version.h b/version.h index 9056fcccb..e4e266d6d 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 260 +#define RUBY_PATCHLEVEL 261 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- cgit