Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-49259

character corruption when unzipping Windows zipped files with Japanese filename

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.9, 2.6.8, 2.7.5, 2.8.3
    • 2.7.6, 2.8.4
    • Files API, Language
    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • master
    • Easy
    • Hide

      To test the issue:
      1. Login to Moodle.
      2. Change Moodle site language to Japanese(ja).
      3. Go to "My private files" area.
      4. Upload japanese_filenames.zip to "Files" area.
      5. Click "japanese_filenames.zip".
      6. Click "Unzip" button.
      7. Click "japanese_filenames" folder.
      8. You will see corrupted Japanese filenames (wrong_filename.png).

      Expected result after the fix:
      1. Login to Moodle.
      2. Change Moodle site language to Japanese(ja).
      3. Go to "My private files" area.
      4. Upload japanese_filenames.zip to "Files" area.
      5. Click "japanese_filenames.zip".
      6. Click "Unzip" button.
      7. Click "japanese_filenames" folder.
      8. You will see correct Japanese filenames (correct_filename.png).

      Show
      To test the issue: 1. Login to Moodle. 2. Change Moodle site language to Japanese(ja). 3. Go to "My private files" area. 4. Upload japanese_filenames.zip to "Files" area. 5. Click "japanese_filenames.zip". 6. Click "Unzip" button. 7. Click "japanese_filenames" folder. 8. You will see corrupted Japanese filenames (wrong_filename.png). Expected result after the fix: 1. Login to Moodle. 2. Change Moodle site language to Japanese(ja). 3. Go to "My private files" area. 4. Upload japanese_filenames.zip to "Files" area. 5. Click "japanese_filenames.zip". 6. Click "Unzip" button. 7. Click "japanese_filenames" folder. 8. You will see correct Japanese filenames (correct_filename.png).

    Description

      When we unzip Windows zipped files with Japanese filename on "My private files" area, the filename will be corrupted.
      To avoid this issue, we need to add one line to lib/filestorage/zip_archive.php as below.

      Filename:
      lib/filestorage/zip_archive.php

      Line:
      658

      [ before ]
      case 'ISO-8859-8': $encoding = 'CP862'; break;
      case 'UTF-8':

      [ After ]
      case 'ISO-8859-8': $encoding = 'CP862'; break;
      case 'EUC-JP':
      case 'UTF-8':

      Attachments

        1. character corruption.png
          146 kB
          Mitsuhiro Yoshida
        2. correct_filename.png
          70 kB
          Mitsuhiro Yoshida
        3. wrong_filename.png
          69 kB
          Mitsuhiro Yoshida

        Activity

          People

            mits Mitsuhiro Yoshida
            mits Mitsuhiro Yoshida
            Adrian Greeve Adrian Greeve
            Dan Poltawski Dan Poltawski
            Dave Cooper Dave Cooper
            Matteo Scaramuccia, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Aya Saad, David Mudrák (@mudrd8mz), Helen Foster, Victor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Mar/15