Sonnich Posted June 18, 2020 Share Posted June 18, 2020 I am moved a clients system from one ISP running PHP5.5 to a new ISP running PHP7.2 My problem is coding of filenames when I create zip files, with non English letters. I found this to work with CP775. $dl[$z]=iconv("UTF-8", "CP775//TRANSLIT", $dl[$z]); $zip->addFile($file, implode("/", $dl)); Now, would it be possible to detect what CP to use from the system? I found mb_detect_encoding but it does not tell me much. Quote Link to comment Share on other sites More sharing options...
gw1500se Posted June 18, 2020 Share Posted June 18, 2020 Will utf8-decode help? Quote Link to comment Share on other sites More sharing options...
Sonnich Posted June 18, 2020 Author Share Posted June 18, 2020 No, that is not what I am looking for. I made a script so I could try multiple Codepages at once, for the download, and started figuring out which one it right. Knowing that I am in the Baltics then 775 and 1257 were obvuious choices after some failures, and it work - here for now. But how can I get to know what CP to use in other cases? Using no CP conversion on one server causes the filenames to contain wrong charactes, e.g. ü becomes _ (underscore) etc. On another server it is not an issue and I can use the filename directly Quote Link to comment Share on other sites More sharing options...
requinix Posted June 18, 2020 Share Posted June 18, 2020 Make sure PHP is being run with the correct locale, then retrieve it. Note that's not a complete answer. You'll need to investigate and test a little. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.