php creating zip file for files with unicode names -


in php app did following:

$dn = sys_get_temp_dir() . '/' . uniqid('td', false); if (mkdir($dn) === true) {     $fn = $dn . '/' . '関連事業調査.xls';     $writer = new \phpexcel_writer_excel5($wb);     $writer->save($fn);      $fzip = sys_get_temp_dir() . '/' . uniqid('td', false) . '.zip';     $password = $this->container->getparameter('zippassword');     $out = null;      $ret = null;     exec("zip -qjp $password $fzip $dn" . '/*', &$out, &$ret); } 

in linux environment correctly creates zip file given password. can unzip files in linux without problem. if download windows, , extract files, file names become incorrect. how solve problem?

zip files don't have specified encoding filenames*. consequently use of non-ascii characters unreliable.

*: not true: there extension format allows utf-8 filenames used, , zip command use it. windows's zip interface (“compressed folders”) doesn't support it, , uses default (“ansi”) code page interpret filename bytes. if know target audience have windows boxes particular locale can target locale... otherwise, best stick ascii.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -