codepages - DotNetZip zipping files with Arabic names -


when creating zip file out of many arabic named files, have prompted in dotnetzip's faq changed code page following:

                  using zip new zipfile()                 zip.adddirectorybyname("files")                 zip.alternateencoding = encoding.utf8                 zip.alternateencodingusage = ionic.zip.zipoption.always                 dim row integer                 row = 0 ds.tables("d").rows.count - 1                      filetodownload = server.mappath("~/.../resources/attachments/" + ds.tables("d").rows(row).item(1).tostring)                     zip.addfile(filetodownload, "files")                  next                 response.clear()                 response.bufferoutput = false                 dim zipname string = [string].format(gvrow.cells(8).text.trim + ".zip")                 response.contenttype = "application/zip"                 response.addheader("content-disposition", "attachment; filename=" + zipname)                 zip.save(response.outputstream)                 response.[end]()              end using 

i have used several listed arabic encoding codes, of them produce '???' whereas 1 produces names following: '¦ßs-¦ µ+++ ¦ß+pß.docx'

what correct code used? or missing something?

use utf8 encoding , pass parameter constructor:

io.file.delete("d:/testzip.zip") using zip new ionic.zip.zipfile(encoding.utf8)       zip.adddirectory("d:/out")       zip.save("d:/testzip.zip") end using 

this code works me arabic file names (windows 7).
edit #1 :
must force dotnetzip use specified encoding using always option instead of asnesseary :

 io.file.delete("d:/testzip.zip")   using zip new ionic.zip.zipfile()             zip.alternateencoding = encoding.utf8             zip.alternateencodingusage = ionic.zip.zipoption.always             zip.adddirectory("d:/out")             zip.save("d:/testzip.zip")   end using 

edit #2 :
based on comment, think operating system not support arabic ui,for windows 7 professional 32 bit, go control panel -> region , language -> administrative [tab] -> click "change system locale" button -> choose "arabic egypt" example -> ok -> ok (restart computer needed) , don't worry, language of windows 7 still english.
edit #3 :
mentioned in edit #2, system must support arabic ui, example, create file called (ملف جديد) add archive using winzip or winrar, open generated archive, if can read file names correctly , try use 1 of following encodings in code :

encoding.unicode encoding.utf7 encoding.utf8 encoding.utf32 

if unable read arabic file names inside generated archive, must configure system support arabic ui.
also, please use following order these lines, put encoding, add files or folders :

zip.alternateencoding = encoding.utf8 zip.alternateencodingusage = ionic.zip.zipoption.always zip.adddirectorybyname("files") 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -