• Making a restore I noticed that the restored file names containing non ASCII file names were garbled.The letters “å”, “ä” and “ö” were replaced with two other characters.

    Checking inside the actual backup ZIP files the file names of the stored files were stored with replaced åäö characters. This issue exists no matter where in the file name these characters are.

    Using WP 4.2 and Updraft 1.11.5.

    Checking my friends installation running WP 4.2.2 and Updraft 1.11.4 is has the same problem.

    https://wordpress.org/plugins/updraftplus/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author David Anderson

    (@davidanderson)

    Hi,

    Please can you provide a link to your log file for the problematic backup? (You can download it from the “Existing Backups” tab of your UpdraftPlus settings page).

    It’ll be too long to paste into the forum here, but you can download it to your computer, and share it with Dropbox, or paste it in pastebin.com, or any similar service, and post the link here.

    Best wishes,
    David

    Thread Starter lsoderst

    (@lsoderst)

    I appreciate the effort! The logs can be download at http://www.krav-maga.nu/updraft-log.zip

    BR
    Lars

    Thread Starter lsoderst

    (@lsoderst)

    Any news?

    Plugin Author David Anderson

    (@davidanderson)

    Hi,

    Yes, sorry to be slow. I did analyse the problem and it is caused by the PclZip engine that is bundled with WordPress not being able to handle non-ASCII characters. This zip engine is the third choice – UpdraftPlus prefers /usr/bin/zip, and then ZipArchive (part of PHP), but your webserver has neither of those.

    However, it seems that a PHP snippet can be written to correctly unpack zip files created by PclZip, translating them back to UTF8. I was going to test this and send you the snippet. I have not had time yet – I will need to reply to you again later in the week.

    Though, if you can update your PHP install (PHP 5.2.4 is the oldest one supported by WordPress, and has very many security issues – even PHP 5.4 is being end-of-lifed by the PHP group in a few days time – http://php.net/supported-versions.php ), or at least install the PHP ZipArchive module, then the problem will go away.

    David

    Thread Starter lsoderst

    (@lsoderst)

    Thanks!
    However, I am currently using PHP 5.4.42 and still have the same problem. I have asked my hosting provider to install ZipArchive, but they will not do that.
    BR
    Lars

    Plugin Author David Anderson

    (@davidanderson)

    Hi,

    The code below works for me. To use it, you’ll need to 1) edit the value of $zipfile near the top and 2) copy the zipfile and a copy of wp-admin/includes/class-pclzip.php into the directory together with the script, and then 3) run the script directly (i.e. run it through your PHP binary).

    <?php
    
    $zipfile = 'backup_2015-09-03-1444_Empty_WordPress_b2180840b77e-others.zip';
    
    require('class-pclzip.php');
    $zip = new PclZip($zipfile);
    
    if (!function_exists('zipPreExtractCallBack')) {
        function zipPreExtractCallBack($p_event, &$p_header) {
            $info = pathinfo($p_header['filename']);
            $only_these_extensions = array('jpeg', 'jpg', 'gif', 'png');
            // limit the unzipped images
            if (1 || in_array($info['extension'], $only_these_extensions)) {
                $get_host_iconv_encode = iconv_get_encoding("internal_encoding");
                $get_file_mb_encode = mb_detect_encoding( $info['basename'] );
                $p_header['filename'] = iconv( $get_host_iconv_encode , $get_file_mb_encode.'//TRANSLIT//IGNORE' , $p_header['filename'] );
                return 1;
            }
            // other file extension will not be unzipped
            else return 0;
        }
    }
    
    $extract = $zip->extract(PCLZIP_OPT_PATH, 'unzipped', PCLZIP_CB_PRE_EXTRACT, 'zipPreExtractCallBack');
    
    if ( $extract == 0 ) {
       echo "Error : ".$zip->errorInfo(TRUE)."\n";
    } else {
       echo "OK\n";
    }

    David

    Thread Starter lsoderst

    (@lsoderst)

    Thanks! I’ll give it a try.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Garbled non ASCII characters file names’ is closed to new replies.