diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 1d03ef629..c1695e384 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -180,9 +180,9 @@ class ZipdownController < ApplicationController def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) - ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE') rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip" zipfile_name = "#{output_path}/#{rename_zipfile}" + Zip.unicode_names = true Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name)) Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| @@ -190,7 +190,7 @@ class ZipdownController < ApplicationController rename_file = File.basename(filename) rename_file = filename_to_real( File.basename(filename)) if is_attachment begin - zipfile.add(ic.iconv(rename_file), filename) + zipfile.add(rename_file, filename) rescue Exception => e zipfile.get_output_stream('FILE_NOTICE.txt'){|os| os.write l(:label_file_exist)} next