Description:
make java accept utf8
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r180:b08eea94d57b - - 2 files changed: 4 inserted, 2 deleted

@@ -111,7 +111,8
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*\;/
@@ -122,7 +123,7
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,5 +129,6
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