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

ruby-changes:2265

From: ko1@a...
Date: 23 Oct 2007 10:43:39 +0900
Subject: [ruby-changes:2265] nobu - Ruby:r13756 (trunk): * ruby.c (process_options): encoding set by command line option takes

nobu	2007-10-23 10:42:53 +0900 (Tue, 23 Oct 2007)

  New Revision: 13756

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

  Log:
    * ruby.c (process_options): encoding set by command line option takes
      priority over the encoding in the source, as the primary encoding.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=13756&r2=13755
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13756&r2=13755

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13755)
+++ ChangeLog	(revision 13756)
@@ -1,3 +1,8 @@
+Tue Oct 23 10:42:51 2007  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c (process_options): encoding set by command line option takes
+	  priority over the encoding in the source, as the primary encoding.
+
 Mon Oct 22 11:03:09 2007  Nobuyoshi Nakada  <nobu@r...>
 
 	* encoding.c (enc_check_encoding): returns index now.
Index: ruby.c
===================================================================
--- ruby.c	(revision 13755)
+++ ruby.c	(revision 13756)
@@ -843,6 +843,7 @@
     char **argv = opt->argv;
     NODE *tree = 0;
     VALUE parser;
+    VALUE encoding;
     const char *s;
     int i = proc_options(argc, argv, opt);
 
@@ -970,7 +971,13 @@
 	}
     }
 
-    rb_set_primary_encoding(rb_parser_encoding(parser));
+    if (opt->enc_index >= 0) {
+	encoding = rb_enc_from_encoding(rb_enc_from_index(opt->enc_index));
+    }
+    else {
+	encoding = rb_parser_encoding(parser);
+    }
+    rb_set_primary_encoding(encoding);
 
     return (VALUE)tree;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

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