Recent

Author Topic: Unit Zipper from package paszlib has an inconsistency  (Read 5450 times)

tetrastes

  • Sr. Member
  • ****
  • Posts: 473
Re: Unit Zipper from package paszlib has an inconsistency
« Reply #30 on: April 28, 2021, 12:43:30 pm »
This has nothing to do with zipper. It is a standard problem in FPC string handling. If you use zipper in an LCL GUI program everything works fine because the standard encoding is UTF8. The problem mentioned appears in standalone commandline programs in which FPC does not switch to UTF8 by default.

Simply call SetMultiByteConversionCodePage(CP_UTF8) as the first line of your program and the zipper handles utf8-encoded file names correctly. See also attached demo.

Have you tested generated by your demo test.zip? 

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Unit Zipper from package paszlib has an inconsistency
« Reply #31 on: April 28, 2021, 12:56:11 pm »
Yes, of course. But I use PowerArchiver to display the zip rather than 7zip, and it displays the directory correctly. And the unzipped folder contains the alpha-beta-gamma.txt file - did you look in the "unzipped" folder? (And alpha, beta, gamma are not on my Windows code page).

tetrastes

  • Sr. Member
  • ****
  • Posts: 473
Re: Unit Zipper from package paszlib has an inconsistency
« Reply #32 on: April 28, 2021, 01:37:08 pm »
The unzipped folder contains the αβγ.txt file only if test.zip unzipped with your demo (i.e. zipper.pp) and may be with PowerArchiver, and may be smth else, which supposes that filenames in archive in utf8. But this is not what Windows uses for filenames. And other unzippers will unzip it to ╬▒╬▓╬│.txt.   

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Unit Zipper from package paszlib has an inconsistency
« Reply #33 on: April 28, 2021, 04:43:33 pm »
ok, I see it in the Win Explorer now. But after some seeking I found that there is a TZipper property UseLanguageEncoding which, when set to true, writes the archive names in UTF8 encoding.

There is also a UseUTF8 property for the Unzipper, but I did not find it necessary to set it to true. Also, calling the SetMultiByteConversionCodepage was not required any more after activating the UseLanguageEncoding property.

Oh man - I think the paszlib wiki page in which zipper is documented needs a rewrite...

 

TinyPortal © 2005-2018