Bug #77516 [Fbk->NoF]: ZipArchive::open not use default_charset setting
| From: | php-bugs at lists dot php dot net | Date: | Sun, 03 Feb 2019 04:22:04 +0000 |
| Subject: | Bug #77516 [Fbk->NoF]: ZipArchive::open not use default_charset setting | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219341@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: php-bugs@lists.php.net
Reported by: offluri at gmail dot com
Summary: ZipArchive::open not use default_charset setting
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Zip Related
Operating System: Windows 7
PHP Version: 7.2.14
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2019-01-25 11:20:38] ab@php.net
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.
------------------------------------------------------------------------
[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