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

character corruption when unzipping Windows zipped files with Japanese filename

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.9, 2.6.8, 2.7.5, 2.8.3
    • Fix Version/s: 2.7.6, 2.8.4
    • Component/s: Files API, Language
    • Labels:
    • Testing Instructions:
      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).
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      master

      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
          character corruption.png
          146 kB
        2. correct_filename.png
          correct_filename.png
          70 kB
        3. japanese_filenames.zip
          0.6 kB
        4. wrong_filename.png
          wrong_filename.png
          69 kB

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Mar/15