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