[Lazarus] GZip issues

Werner Pamler werner.pamler at freenet.de
Sun Nov 15 22:11:48 CET 2015


In the LazarusMailingListReader, I am decompressing the downloaded gzip 
mail archives by using the Abbrevia package. This is working fine in 
Windows, but Linux rejects to compile the package due to an "identifier 
nl_langinfo not found" error in this procedure of unit AbCharset:

function AbSysCharSetIsUTF8: Boolean;
begin
   {$IFDEF DARWIN}
   Result := True;
   {$ENDIF}
   {$IFDEF MSWINDOWS}
   Result := False;
   {$ENDIF}
   {$IFDEF LINUX}
   Result := StrComp(nl_langinfo(_NL_CTYPE_CODESET_NAME), 'UTF-8') = 0;
   {$ENDIF}
end;

As I found out "nl_langinfo" belongs to libc, and in fact, this can be 
activated by a define in the package, but this in turn causes other 
compilation errors. My question: Is there a funtion in the standard fpc 
units with the same functionality?

Another question: I would prefer to avoid Abbrevia altogether and use 
the standard zip support in fpc. There are examples in the wiki on how 
to use the TDecompressionStream for inflating gzip files. But I always 
get a "data error"at least with the mailinglist archive files from 
http://lists.lazarus.freepascal.org/pipermail/lazarus/. If I use a 
TGZFileStream instead of the TDecompressionStream by a TGZFileStream, 
then the file decompresses fine. But this is not a good solution as I 
would have to use temporary files which I want to avoid. How can the 
TGZFileStream be modified such that it accepts a stream as input 
parameter instead of a filename?




More information about the Lazarus mailing list