Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Zip with Unicode FilenamesThe NTFS filesystem supports Unicode and filenames can contain characters in any language. However, the Zip file standard is only capable of supporting a single language at a time (i.e. a single OEM code page). If your computer's default OEM code page is different than the language of the filename, then you would need to set the Zip.OemCodePage property to the correct value prior to appending files.
Here is a list of OEM code pages: uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ChilkatZip2Lib_TLB, OleCtrls; ... procedure TForm1.Button1Click(Sender: TObject); var zip: TChilkatZip2; success: Integer; zip2: TChilkatZip2; begin // This example creates a .zip with filenames containing // Chinese characters. Using Chilkat Zip, the .zip can // be created and unzipped on any locale computer. However, // to unzip using a program such as WinZip, it must run // on a computer with the correct locale. zip := TChilkatZip2.Create(Self); // Any string unlocks the component for the 1st 30-days. success := zip.UnlockComponent('Anything for 30-day trial'); if (success <> 1) then begin ShowMessage(zip.LastErrorText); end; zip.NewZip('chinese.zip'); // Set the OEM code page to Chinese Big5 zip.OemCodePage := 950; // Add references to all files under a "chinese" subdirectory. // This directory will contain filenames having Chinese characters. zip.AppendFiles('chinese',1); success := zip.WriteZipAndClose(); if (success <> 1) then begin ShowMessage(zip.LastErrorText); end; // Create a new instance of a zip object. Load the .zip // we previously created and unzip to another directory. zip2 := TChilkatZip2.Create(Self); // Don't forget to set the OEM code page... zip2.OemCodePage := 950; success := zip2.OpenZip('chinese.zip'); if (success <> 1) then begin ShowMessage(zip2.LastErrorText); end; // This will unzip correctly on any locale computer. success := zip2.Unzip('outDir'); if (success <> 1) then begin ShowMessage(zip2.LastErrorText); end else begin ShowMessage('unzipped!'); end; end; |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.