Moodle

"unzip" uploaded windows-zip-files (filenames have german umlaute äüöß) in coursefiles, the filenames apears very strange (non readable)

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6.2
  • Fix Version/s: 2.0
  • Component/s: Unknown
  • Labels:
    None
  • Environment:
    Environment: Moodle 1.6.2+ (2006050521)
    ubuntu 6.0.6, ext3-filesystem, locale: LANG=de_DE.UTF-8
    database mysql version 5.0.22
    php version 5.1.2
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_16_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Hi,
when "unzip" uploaded windows-zip-files (filenames have german umlaute äüöß) in coursefiles, the filenames apears very strange (non readable).

Unpacking test/aeueoesstest.zip:
Name Size Modified Status
????test.txt 5 bytes 22 September 2006, 04:24 ok

A renaming or deleting is not possible:

Error: could not rename ????test.txt to test.txt

Name Size Modified Action
Parent folder
aeueoesstest.zip 127 bytes 27 Sep 2006, 03:43 Unzip List Restore Rename
????test.txt 5 bytes 22 Sep 2006, 04:24 Edit Rename

Any solutions?

P.S.: there are no other utf-8 umlaut problems on my site...

Bertold

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

This is a known problem - ZIP compression format does not support Unicode at all, sorry

It is known to sort of work in windows, but breaks badly when unzipping in *nix or using our PCLZIP library, I spent several days trying to work around this problem but was unable to find suitable solution.

Show
Petr Škoda (skodak) added a comment - This is a known problem - ZIP compression format does not support Unicode at all, sorry It is known to sort of work in windows, but breaks badly when unzipping in *nix or using our PCLZIP library, I spent several days trying to work around this problem but was unable to find suitable solution.
Hide
Ling Li added a comment -

We met this problem too in Chinese and we have already created some patches to solve the problem. Although they are some ugly, bu we do have use them for several month without any problem.

We add a choise menu to the zip/unzip page and let user choose UTF-8 or his native charset. PCLZIP library is always used to zip/unzip files, so we can change the charset of filenames in zipfile when doing zip/unzip.

lib_moodlelib_php.diff is for lib/moodlelib.php
files_index_php.diff is for files/index.php

Besides the patch, a string named "nativecharset" should be added to langconfig.php file in your language files. E.g. for Simplified Chinese(zh_cn_utf8), we add

$string['nativecharset'] = 'GB18030';

We have only tested it on Linux.

Show
Ling Li added a comment - We met this problem too in Chinese and we have already created some patches to solve the problem. Although they are some ugly, bu we do have use them for several month without any problem. We add a choise menu to the zip/unzip page and let user choose UTF-8 or his native charset. PCLZIP library is always used to zip/unzip files, so we can change the charset of filenames in zipfile when doing zip/unzip. lib_moodlelib_php.diff is for lib/moodlelib.php files_index_php.diff is for files/index.php Besides the patch, a string named "nativecharset" should be added to langconfig.php file in your language files. E.g. for Simplified Chinese(zh_cn_utf8), we add $string['nativecharset'] = 'GB18030'; We have only tested it on Linux.
Hide
Jean Benoit added a comment -

I successfully unzipped a file on Linux containing native windows filenames using the perl module Archive::Zip ;
you can use this sample code :

#!/usr/bin/perl

use Archive::Zip qw( :ERROR_CODES :CONSTANTS );

$zip = Archive::Zip->new();

die 'read error' unless $zip->read( $ARGV[0] ) == AZ_OK;

my @members = $zip->memberNames();
foreach $m (@members) {
print "$m\n";
$zip->extractMember($m) ;
}

Show
Jean Benoit added a comment - I successfully unzipped a file on Linux containing native windows filenames using the perl module Archive::Zip ; you can use this sample code : #!/usr/bin/perl use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); $zip = Archive::Zip->new(); die 'read error' unless $zip->read( $ARGV[0] ) == AZ_OK; my @members = $zip->memberNames(); foreach $m (@members) { print "$m\n"; $zip->extractMember($m) ; }
Hide
Bertold Altaner added a comment -

Thanks,
i've tested it on my moodle 1.7 system but it doesn't work...
I take your original code: unzip.pl
#!/usr/bin/perl
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
$zip = Archive::Zip->new();
die 'read error' unless $zip->read( $ARGV[0] ) == AZ_OK;
my @members = $zip->memberNames();
foreach $m (@members) {
print "$m\n";
$zip->extractMember($m) ;
}

unzipping on command-line works, but when used with moodle I got following error:
IO error: opening -o for read : No such file or directory
at /usr/share/perl5/Archive/Zip.pm line 938
Archive::Zip::Archive::read('Archive::Zip::Archive=HASH(0x814bd48)', '-o') called at /var/www/forum/unzip.pl line 4
read error at /var/www/forum/unzip.pl line 4.

In moodle I configured System Paths:
path to unzip: /var/www/forum/unzip.pl

Any suggestions?

Show
Bertold Altaner added a comment - Thanks, i've tested it on my moodle 1.7 system but it doesn't work... I take your original code: unzip.pl #!/usr/bin/perl use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); $zip = Archive::Zip->new(); die 'read error' unless $zip->read( $ARGV[0] ) == AZ_OK; my @members = $zip->memberNames(); foreach $m (@members) { print "$m\n"; $zip->extractMember($m) ; } unzipping on command-line works, but when used with moodle I got following error: IO error: opening -o for read : No such file or directory at /usr/share/perl5/Archive/Zip.pm line 938 Archive::Zip::Archive::read('Archive::Zip::Archive=HASH(0x814bd48)', '-o') called at /var/www/forum/unzip.pl line 4 read error at /var/www/forum/unzip.pl line 4. In moodle I configured System Paths: path to unzip: /var/www/forum/unzip.pl Any suggestions?
Hide
Jens Gammelgaard added a comment -

Hi,

This seems to be an issue in version 1.91+ or should it be adjusted in the php.ini with for example the zlib.output_handler?

BR
Jens

Show
Jens Gammelgaard added a comment - Hi, This seems to be an issue in version 1.91+ or should it be adjusted in the php.ini with for example the zlib.output_handler? BR Jens
Hide
Samuli Karevaara added a comment -

Hoe about with PHP Zip extension, now that it's being used (or soon anyway?) in Moodle?

Show
Samuli Karevaara added a comment - Hoe about with PHP Zip extension, now that it's being used (or soon anyway?) in Moodle?
Hide
Petr Škoda (skodak) added a comment -

should finally work in 2.0dev, it might be still improved

Show
Petr Škoda (skodak) added a comment - should finally work in 2.0dev, it might be still improved

Dates

  • Created:
    Updated:
    Resolved: