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

ruby-changes:24468

From: naruse <ko1@a...>
Date: Tue, 24 Jul 2012 17:48:03 +0900 (JST)
Subject: [ruby-changes:24468] naruse:r36519 (trunk): Add the case of Unix: filesystem encoding maybe US-ASCII.

naruse	2012-07-24 17:47:51 +0900 (Tue, 24 Jul 2012)

  New Revision: 36519

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36519

  Log:
    Add the case of Unix: filesystem encoding maybe US-ASCII.

  Modified files:
    trunk/test/ruby/test_dir_m17n.rb

Index: test/ruby/test_dir_m17n.rb
===================================================================
--- test/ruby/test_dir_m17n.rb	(revision 36518)
+++ test/ruby/test_dir_m17n.rb	(revision 36519)
@@ -196,7 +196,9 @@
       EOS
       assert_ruby_status(%w[-EASCII-8BIT], <<-'EOS', nil, :chdir=>d)
         filename = "\xA4\xA2".force_encoding('ASCII-8BIT')
-        win_expected_filename = filename.force_encoding("euc-jp").encode(Encoding.find("filesystem")) rescue "?"
+        win_expected_filename =
+          [Encoding::US_ASCII, Encoding::ASCII_8BIT].include?(Encoding.find("filesystem")) \
+          ? filename : filename.encode(Encoding.find("filesystem"), "euc-jp") rescue "?"
         opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
         ents = Dir.entries(".", opts)
         result = ents.include?(filename) ||

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

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