Bug #77516 [Opn->Fbk]: ZipArchive::open not use default_charset setting

From: Date: Fri, 25 Jan 2019 11:20:38 +0000
Subject: Bug #77516 [Opn->Fbk]: ZipArchive::open not use default_charset setting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219196@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77516&edit=1 ID: 77516 Updated by: ab@php.net Reported by: offluri at gmail dot com Summary: ZipArchive::open not use default_charset setting -Status: Open +Status: Feedback Type: Bug Package: Zip Related Operating System: Windows 7 PHP Version: 7.2.14 Block user comment: N Private report: N New Comment: Thanks for the report. Please be sure your script with the hardcoded filename is UTF-8 encoded as well. ZipArchive::open() is just fine with UTF-8 filenames, ANSI filenames are supported too. Also, you mention is_file() all the time, but there's no occurrence in the repro code. What exactly is the issue with is_file()? In general, using UTF-8 everywhere should solve your issue. Thanks. Previous Comments: ------------------------------------------------------------------------ [2019-01-24 16:10:43] offluri at gmail dot com Description: ------------ Hello, I'm working in windows (french) on a console php script with Windows-1252 charset. I'm change default_charset seting in php.ini : default_charset = "Windows-1252" My script convert a .ods file in a .sql script with using phpspreadsheet lib. I'm use a batch file to launch my php script. This allow drag-and-drop file over .bat to launch conversion. Problem : This not work with filename countain accentuated char. Problem is in ZipArchive::Open(). Filename must be encoded with UTF-8 charset to work. Before open file, phpspreadsheet verify if file exist and readable with use is_file() and is_readable(). In this function, filename must be encoded with default_charset setting. So i have a problem : If I translate filename to UTF-8, it's not work (is_file() block) but when i left CP1252 charset, ZipArchive::Open() not work. This is inconsistent. Can you modify ZipArchive::Open()for this function use default_charset setting for filename parameters ? Ty Test script: --------------- // For just test ZipArchive : $zip = new ZipArchive(); $res = $zip->open("Différence.ods"); if ($res!== true) { echo 'FAIL'; } else { echo 'OK'; } Expected result: ---------------- OK (In Windows with "Différence.ods" LibreOffice calc file AND default_charset = "Windows-1252" in php.ini) Actual result: -------------- FAIL (In Windows with "Différence.ods" LibreOffice calc file AND default_charset = "Windows-1252" in php.ini) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77516&edit=1

« previous php.bugs (#219196) next »