login about faq

Hi there, I am trying do write a program with the help of Chilkat Zip C/C++ Library. I have a question when I try to zip files with Chinese characters in filenames.

I saw some solution here use


firstly and then use

               zip.AppendFiles(Directory, recurse)

However, I tried this but it didn't work. Even if it worked, I would prefer to find a way working on the file instead of the directory, since most of the time the directory contains some other files which should not be zipped. For example, suppose during my program I create two files under directory C:temp\

               file1.txt   , 文件1.doc

And only 文件1.doc should be zipped.

Really appreciate anyone who gives some ideas. Thanks very much!

asked Dec 23 '14 at 05:15

Veda's gravatar image


If using AppendFiles to add files to a .zip, then all filenames should be correctly added because internally, Chilkat works in utf-8.

If the OemCodePage property is set to 65001 (which is the code page value for utf-8), then Chilkat Zip will correctly produce a .zip with utf-8 filenames. I have no doubt that this is working correctly.

Problems can arise if:

  1. The filesystem itself does not support Unicode filenames.
  2. A zip utility or other zip software does not support reading .zip archives having utf-8 filenames. (For example, WinZip added support for Unicode (utf-8) filenames starting with version 11.2. Some zip software still exists that doesn't support utf-8 filenames).

Passing Unicode between your application and Chilkat is possible in two ways: Either through the Unicode C++ API (wchar_t) or through the multibyte API (which you are currently using) with utf-8.

To use wchar_t, use the Chilkat classes ending with "W". See here: http://www.chilkatsoft.com/refdoc/wcppCkZipWRef.html

To pass utf-8 strings to the Chilkat multibyte API (and to tell Chilkat to return utf-8), use the "Utf8" property. See here: http://www.cknotes.com/utf8-c-property-allows-for-utf-8-or-ansi-const-char/


answered Dec 24 '14 at 10:08

chilkat's gravatar image

chilkat ♦♦


Sorry I "don't have enough reputation points to upvote". And thanks very much for your answer. wchar_t works for me.

Anyway I also found CkZipW.h. I recommend you put it on your Chilkat Home page. At first I didn't have any clue of this version.

Again thanks a lot and happy new year!

(Dec 28 '14 at 20:50) Veda

PS> it is also possible to append individual files to a .zip via the AppendOneFileOrDir method.


answered Dec 24 '14 at 10:10

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Dec 23 '14 at 05:15

Seen: 3,124 times

Last updated: Dec 28 '14 at 20:50

powered by OSQA