[前][次][番号順一覧][スレッド一覧]

ruby-changes:3520

From: ko1@a...
Date: Sun, 13 Jan 2008 15:37:40 +0900 (JST)
Subject: [ruby-changes:3520] naruse - Ruby:r14998 (trunk): * ruby.c (process_options): -e'script' is locale encoding by default.

naruse	2008-01-12 04:41:22 +0900 (Sat, 12 Jan 2008)

  New Revision: 14998

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

  Log:
    * ruby.c (process_options): -e'script' is locale encoding by default.
      (load_file): ruby script from stdin is locale encoding by default.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=14998&r2=14997&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14998&r2=14997&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14997)
+++ ChangeLog	(revision 14998)
@@ -1,3 +1,8 @@
+Sat Jan 12 04:38:38 2008  NARUSE, Yui  <naruse@r...>
+
+	* ruby.c (process_options): -e'script' is locale encoding by default.
+	  (load_file): ruby script from stdin is locale encoding by default.
+
 Sat Jan 12 04:31:59 2008  NARUSE, Yui  <naruse@r...>
 
 	* ext/nkf/nkf-utf8/nkf.c: fix bug: -m was -m0.
Index: ruby.c
===================================================================
--- ruby.c	(revision 14997)
+++ ruby.c	(revision 14998)
@@ -984,9 +984,14 @@
     if (opt->enc_name != 0) {
 	opt->enc_index = opt_enc_index(opt->enc_name);
     }
+    if (opt->enc_index >= 0) {
+	enc = rb_enc_from_index(opt->enc_index);
+    }
+    else {
+	enc = rb_locale_encoding();
+    }
     if (opt->e_script) {
-	if (opt->enc_index >= 0)
-	    rb_enc_associate_index(opt->e_script, opt->enc_index);
+	rb_enc_associate(opt->e_script, enc);
 	require_libraries();
 	tree = rb_parser_compile_string(parser, opt->script, opt->e_script, 1);
     }
@@ -1021,12 +1026,6 @@
 	}
     }
 
-    if (opt->enc_index >= 0) {
-	enc = rb_enc_from_index(opt->enc_index);
-    }
-    else {
-	enc = rb_locale_encoding();
-    }
     rb_enc_set_default_external(rb_enc_from_encoding(enc));
 
     return (VALUE)tree;
@@ -1153,6 +1152,7 @@
 	require_libraries();	/* Why here? unnatural */
     }
     if (opt->enc_index >= 0) rb_enc_associate_index(f, opt->enc_index);
+    else rb_enc_associate(f, rb_locale_encoding());
     tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start);
     if (script && rb_parser_end_seen_p(parser)) {
 	rb_define_global_const("DATA", f);

--
ML: ruby-changes@q...
Info: 

[前][次][番号順一覧][スレッド一覧]