• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


Commit MetaInfo

Revisão852b0912eb5b45c48bc6d0679d52260677f7ece0 (tree)
Hora2014-07-26 16:33:18
AutorDaigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Mensagem de Log

Fixed an encoding issue for mk_rate

Mudança Sumário

Diff

--- a/mk_rate
+++ b/mk_rate
@@ -679,7 +679,7 @@ def parse(line)
679679 end
680680
681681 if state == "abnormal"
682- csa = CsaFileReader.new file
682+ csa = CsaFileReader.new(file, "EUC-JP")
683683 if $options["abnormal-threshold"] == 0 || csa.ply <= $options["abnormal-threshold"]
684684 return
685685 end
--- a/utils/csa-filter.rb
+++ b/utils/csa-filter.rb
@@ -44,21 +44,21 @@ class CsaFileReader
4444 attr_reader :start_time, :end_time
4545 attr_reader :ply
4646
47- def initialize(file_name)
47+ def initialize(file_name, encoding="Shift_JIS:EUC-JP")
4848 @file_name = file_name
49+ @encoding = encoding
4950 @ply = 0
5051 grep
5152 end
5253
5354 def grep
54- @str = File.open(@file_name, "r:Shift_JIS:EUC-JP").read
55+ @str = File.open(@file_name, "r:#{@encoding}").read
5556
5657
5758 if /^N\+(.*)$/ =~ @str then @black_name = $1.strip end
5859 if /^N\-(.*)$/ =~ @str then @white_name = $1.strip end
5960 if /^'summary:(.*)$/ =~ @str
6061 @state, p1, p2 = $1.split(":").map {|a| a.strip}
61- return if @state == "abnormal"
6262 p1_name, p1_mark = p1.split(" ")
6363 p2_name, p2_mark = p2.split(" ")
6464 if p1_name == @black_name