Description:
merge fix utf8
Commit status:
[Not Reviewed]
References:
merge algo
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r188:4805f3ab73c4 - - 2 files changed: 4 inserted, 2 deleted

@@ -108,24 +108,25
108 108 when "java"
109 109 #rename the file to the public class name
110 110
111 111 #get the class name
112 112 classname = 'DUMMY'
113 113 source = Array.new
114 - File.foreach(params[:source_file]) do |line|
114 + File.foreach(params[:source_file],'r:UTF-8') do |line|
115 + line.encode!('UTF-8','UTF-8',invalid: :replace, replace: '')
115 116 md = /\s*public\s*class\s*(\w*)/.match(line)
116 117 classname=md[1] if md
117 118 source << line unless line =~ /\s*package\s*\w+\s*\;/
118 119 end
119 120 File.open("#{classname}.java","w") do |file|
120 121 source.each do |s|
121 122 file.puts s
122 123 end
123 124 end
124 125 #system("cp #{params[:source_file]} #{classname}.java")
125 - command = "#{JAVA_COMPILER} #{classname}.java"
126 + command = "#{JAVA_COMPILER} -encoding utf8 #{classname}.java"
126 127 system(command, err: params[:message_file])
127 128 if File.exists?(classname + ".class")
128 129 File.open(params[:output_file],"w") {|file| file.write("#{classname}")}
129 130 end
130 131 if classname == 'DUMMY'
131 132 File.open(params[:message_file],"w") {|file| file.write("Cannot find any public class in the source code\n")}
@@ -126,8 +126,9
126 126
127 127 File.open("run_stat","w") do |file|
128 128 file.puts max_runtime
129 129 file.puts peak_memory
130 130 end
131 131
132 + puts "#{all_score} #{all_comment}"
132 133 log "score = #{all_score}\ncomment = #{all_comment}"
133 134 log "max_runtime = #{max_runtime}\npeak_memory = #{peak_memory}"
You need to be logged in to leave comments. Login now