OSDN Git Service

* [mk_game_results] - Fixed for reading Japanese comments under ruby1.9.3p194.
authorDaigo Moriwaki <daigo@debian.org>
Sun, 24 Nov 2013 03:48:34 +0000 (12:48 +0900)
committerDaigo Moriwaki <daigo@debian.org>
Sun, 24 Nov 2013 03:48:34 +0000 (12:48 +0900)
changelog
mk_game_results

index a64dfea..8184ace 100644 (file)
--- a/changelog
+++ b/changelog
@@ -3,6 +3,8 @@
        * [shogi-server]
          - shogi_server/league/floodgate.rb: Improved robustness against
            empty file under ruby 1.9.3p194
        * [shogi-server]
          - shogi_server/league/floodgate.rb: Improved robustness against
            empty file under ruby 1.9.3p194
+       * [mk_game_results]
+         - Fixed for reading Japanese comments under ruby1.9.3p194.
 
 2013-11-23  Daigo Moriwaki <daigo at debian dot org>
 
 
 2013-11-23  Daigo Moriwaki <daigo at debian dot org>
 
index 2a8dbb2..0da4ace 100755 (executable)
@@ -58,7 +58,11 @@ require 'getoptlong'
 # @parameter file an absolute path of a csa file
 #
 def grep(file)
 # @parameter file an absolute path of a csa file
 #
 def grep(file)
-  str = File.open(file).read
+  if RUBY_VERSION >= "1.9.1"
+    str = File.open(file, "r:EUC-JP").read
+  else
+    str = File.open(file, "r").read
+  end
 
   if /^N\+(.*)$/ =~ str then black_name = $1.strip end
   if /^N\-(.*)$/ =~ str then white_name = $1.strip end
 
   if /^N\+(.*)$/ =~ str then black_name = $1.strip end
   if /^N\-(.*)$/ =~ str then white_name = $1.strip end