<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-05-23 15:50 GMT-03:00 Craig Peterson <span dir="ltr"><<a href="mailto:craig@scootersoftware.com" target="_blank">craig@scootersoftware.com</a>></span>:<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"><div class="">> Nice. I can do it, opening a new issue in bugtracker.<br>
<br>
</div>Filename encoding in zip files is poorly defined. The current<br>
APPNOTE.txt says that the only valid encoding is OEM 437, with UTF-8 if<br>
a bit is set in the header, but those were recent additions, and in<br>
practice Windows applications will generally use either the OEM or ANSI<br>
codepage of the current system locale, and files generated on Unix will<br>
be UTF-8 but won't have the language encoding bit set.<br>
<br>
Abbrevia's zip encoding/decoding tries to handle the issue in as<br>
compatible a manner as possible. It stores the original filenames as<br>
OEM/ANSI based on the current system, and stores a UTF-8 copy in an<br>
extended header so there's a known way to decode it when changing<br>
locales. When reading it has to use lookup tables to guess if the<br>
filenames are likely OEM or ANSI. On Unicode-enabled Delphi releases<br>
it's fully Unicode enabled; on FreePascal and older Delphi releases it<br>
only supports ANSI filenames but still does proper encoding/decoding.<br>
<br>
The relevant code is in AbZipTyp.pas in TAbZipItem.SetFilename and<br>
TAbZipItem.LoadFromStream if you want a reference. It's under the MPL,<br>
but I'm the original author and I'm happy to relicense it if someone<br>
else wants to incorporate the code into paszlib.<br>
<br>
<a href="https://sourceforge.net/p/tpabbrevia/code/HEAD/tree/trunk/source/AbZipTyp.pas" target="_blank">https://sourceforge.net/p/tpabbrevia/code/HEAD/tree/trunk/source/AbZipTyp.pas</a><br>
<span class=""><font color="#888888"><br>
--<br>
Craig Peterson<br>
Scooter Software</font></span></blockquote></div><div><br></div><div>Very nice.</div><div><br></div><div>I have a question. Adding this extended header, can I open/uncompress the zip file normally in programs like 7z and WinRAR?</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>