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

ruby-changes:42646

From: nobu <ko1@a...>
Date: Sat, 23 Apr 2016 08:07:00 +0900 (JST)
Subject: [ruby-changes:42646] nobu:r54720 (trunk): ruby.c: fix command line encoding on cygwin

nobu	2016-04-23 09:03:37 +0900 (Sat, 23 Apr 2016)

  New Revision: 54720

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54720

  Log:
    ruby.c: fix command line encoding on cygwin
    
    * ruby.c: cygwin does not use w32_cmdvector, command line can be
      other than UTF-8.  [ruby-dev:49519] [Bug #12184]

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c
    trunk/test/ruby/test_rubyoptions.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54719)
+++ ChangeLog	(revision 54720)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Apr 23 09:03:35 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c: cygwin does not use w32_cmdvector, command line can be
+	  other than UTF-8.  [ruby-dev:49519] [Bug #12184]
+
 Sat Apr 23 01:00:03 2016  Rei Odaira  <Rei.Odaira@g...>
 
 	* configure.in: don't use the system-provided round(3) on AIX.
Index: ruby.c
===================================================================
--- ruby.c	(revision 54719)
+++ ruby.c	(revision 54720)
@@ -396,7 +396,9 @@ translit_char_bin(char *p, int from, int https://github.com/ruby/ruby/blob/trunk/ruby.c#L396
 	p++;
     }
 }
+#endif
 
+#ifdef _WIN32
 # define UTF8_PATH 1
 #endif
 
Index: test/ruby/test_rubyoptions.rb
===================================================================
--- test/ruby/test_rubyoptions.rb	(revision 54719)
+++ test/ruby/test_rubyoptions.rb	(revision 54720)
@@ -720,7 +720,8 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L720
     end
   end
 
-  if /mswin|mingw/ =~ RUBY_PLATFORM
+  case RUBY_PLATFORM
+  when /mswin|mingw/
     def test_command_line_glob_nonascii
       bug10555 = '[ruby-dev:48752] [Bug #10555]'
       name = "\u{3042}.txt"
@@ -757,9 +758,7 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L758
         assert_in_out_err(["-e", "", "test/*"], "", [], [], bug10941)
       end
     end
-  end
 
-  if /mswin|mingw/ =~ RUBY_PLATFORM
     Ougai = %W[\u{68ee}O\u{5916}.txt \u{68ee 9d0e 5916}.txt \u{68ee 9dd7 5916}.txt]
     def test_command_line_glob_noncodepage
       with_tmpchdir do |dir|
@@ -769,6 +768,14 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L768
         assert_in_out_err(["-e", "puts ARGV", "*.txt"], "", ougai)
       end
     end
+  when /cygwin/
+    def test_command_line_non_ascii
+      assert_separately([{"LC_ALL"=>"ja_JP.SJIS"}, "-", "\u{3042}".encode("SJIS")], <<-"end;")
+        bug12184 = '[ruby-dev:49519] [Bug #12184]'
+        a = ARGV[0]
+        assert_equal([Encoding::SJIS, 130, 160], [a.encoding, *a.bytes], bug12184)
+      end;
+    end
   end
 
   def test_script_is_directory

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

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