BackupPC-users

Re: [BackupPC-users] BackupPC_zipCreate and charset for encoding file names

2008-11-18 03:49:55
Subject: Re: [BackupPC-users] BackupPC_zipCreate and charset for encoding file names
From: Alexander Moisseev <moiseev AT mezonplus DOT ru>
To: Craig Barratt <cbarratt AT users.sourceforge DOT net>
Date: Tue, 18 Nov 2008 11:46:49 +0300
My conclusions from PKWARE Application Note:

1. Encoding must be OEM code page of terminal where zip will be viewed or 
unpacked;
2. "version made by" field must be set in accordance with OS where zip will be 
viewed or unpacked;
3. If filenames encoded in UTF-8 (Linux terminal code page), general purpose 
bit 11 for UTF-8 must be set for crossplatform compatibility. Last versions of 
some windows archivers supports it.

I have no idea yet what command line options and defaults must be and how 
integrate it with CGI.
But with hardcoded charset and "version made by" BackupPC_zipCreate works 
perfectly well with most windows archivers.

BackupPC_zipCreate:
8<--------------------------
#=> Set OEM code page for unpacking terminal
my $Charset = "cp866"; #Cyrillic code page. Change to yours windows terminal 
code page.
8<--------------------------
    # Specify the compression level for this member
    $zipmember->desiredCompressionLevel($compLevel) if ($compLevel =~ /[0-9]/);

    #=> Set "version made by" field to 0 (MS-DOS)
    $zipmember->fileAttributeFormat('FA_MSDOS');

    #=> Set general purpose bit 11 for UTF-8
    $zipmember->{bitFlag} = $zipmember->{bitFlag} | 0x0800 if ( $Charset eq "" 
);

    # Finally Zip the member
    $zipfh->addMember($zipmember);
}
8<--------------------------

P.S. Also Appendix D of Application Note on the .ZIP file defines optional 
"Extra Field" storage for UTF filenames. But no archivers that really supports 
it.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [BackupPC-users] BackupPC_zipCreate and charset for encoding file names, Alexander Moisseev <=