Answer the question
In order to leave comments, you need to log in
How to add files with Cyrillic names to tar using Phar?
I need to pack a lot of jpg files with Cyrillic file names on the server into one file for upload.
If you do this:
$a = new PharData('/www/test/my.tar');
$a->addFile('/www/test/привет.jpg', "привет.jpg");
[BadMethodCallException]
Entry привет.jpg does not exist and cannot be created: phar error: invalid path "привет.jpg" contains illegal character (0)
/www/test/tar.php:11
#0: PharData->addFile(string, string)
/www/test/tar.php:11
$a = new PharData('/www/test/my.tar');
$a->addFile('/www/test/привет.jpg', iconv('UTF-8', 'windows-1251', "привет.jpg"));
#0: PharData->addFile(string, string)
/www/test/tar.php:13
Answer the question
In order to leave comments, you need to log in
Everything is fine with ZipArchive with compression without compression
php.net/manual/en/ziparchive.setcompressionname.php
php.net/manual/en/zip.constants.php
CM_STORE
As for PHAR
$p = new PharData('data.tar');
$p->addFile(__DIR__ . '/../app/кирилический файл.php', 'app/кирилический2.php');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question