2014-05-23 13:28 GMT-03:00 Michael Van Canneyt :
Show quoted text 32 lines
On Fri, 23 May 2014, Tomas Hajny wrote:
> On Fri, May 23, 2014 17:38, Reinier Olislagers wrote:
>
>> On 23/05/2014 17:30, Michael Van Canneyt wrote:
>>
>>> On Fri, 23 May 2014, silvioprog wrote:
>>
>> I have a program that makes daily backups, and just discovered this
>>>> problem when I noticed that it did not compressing files with names
>>>> with special characters.
>>>>
>>>
>>> This is not fixable. The zip standard has no rules for encoding
>>> filenames.
>>> Whatever bytes you put in is what comes out.
>>> You are entirely responsible for handling the encoding.
>>>
>>
>> Not quite, according to the spec
>>
http://www.pkware.com/documents/casestudies
>
>
> I can't access this URL (HTTP 403 - Forbidden). The right URL seems to be
>
http://www.pkware.com/documents/casestudies/APPNOTE.TXT.
>
Indeed.
A proper implementation would require a serious rewrite of this component
with a unicode API. This can be entered as a feature request if so desired.
Nice. I can do it, opening a new issue in bugtracker.
Temporarily, I fixed my problem 'underlining' the file name, e.g.:
program project1;
{$mode objfpc}{$H+}
uses
zipper, zstream, sysutils, RUtils {
https://github.com/silvioprog/rutils/blob/master/src/rutils.pas };
var
dir, fil, fn, zip: string;
begin
dir := 'C:\Silvio Clécio\Cópias de segurança\';
fn := 'instrução-para-desbloqueio-do-PIN.pdf';
fil := dir + fn;
zip := dir + RUtils.UnderlineStr(fn + '.zip');
with TZipper.Create do
try
FileName :=
{$IFDEF MSWINDOWS}Utf8ToAnsi({$ENDIF}zip{$IFDEF MSWINDOWS}){$ENDIF};
Entries.AddFileEntry(
{$IFDEF MSWINDOWS}Utf8ToAnsi({$ENDIF}fil{$IFDEF MSWINDOWS}){$ENDIF},
RUtils.UnderlineStr(fn)).CompressionLevel := clMax;
ZipAllFiles;
finally
Free;
end;
end.
Thanks!
Silvio Clécio
My public projects - github.com/silvioprog