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

character corruption when unzipping Windows zipped files with Japanese filename

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.7.6, 2.8.4
    • 2.5.9, 2.6.8, 2.7.5, 2.8.3
    • 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).

      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':

        1. wrong_filename.png
          wrong_filename.png
          69 kB
        2. japanese_filenames.zip
          0.6 kB
        3. correct_filename.png
          correct_filename.png
          70 kB
        4. character corruption.png
          character corruption.png
          146 kB

            mits Mitsuhiro Yoshida
            mits Mitsuhiro Yoshida
            Adrian Greeve Adrian Greeve
            Dan Poltawski Dan Poltawski
            Dave Cooper Dave Cooper
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.