zip打包可能有乱码
This commit is contained in:
parent
3baba9c95e
commit
24ce5191c3
|
@ -180,6 +180,7 @@ 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}"
|
||||
|
||||
|
@ -189,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(rename_file, filename)
|
||||
zipfile.add(ic.iconv(rename_file), filename)
|
||||
rescue Exception => e
|
||||
zipfile.get_output_stream('FILE_NOTICE.txt'){|os| os.write l(:label_file_exist)}
|
||||
next
|
||||
|
@ -238,4 +239,4 @@ class ZipdownController < ApplicationController
|
|||
attach = Attachment.find_by_disk_filename(name)
|
||||
attach.filename
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue