Archived Forum Post

Index of archived forum posts

Question:

CkZip and international characters (UTF)

Apr 29 '13 at 08:26

This function doesn't work because CkZip use "const char" params. If I want to unzip a file with sFileName "c:usersFrançoiseNuñezDesktopMyZip.zip", CkZip doesn't allow this. And If I convert from wstring to string, international characters are missing. Any ideas?

void UnZip(const std::wstring& sFileName, const std::wstring& sPath) {

    CkZip zip;
    zip.UnlockComponent("my serial");        
    zip.OpenZip(sFileName.c_str());
    zip.Extract(sPath.c_str());
    zip.CloseZip();

}


Answer

There are two solutions:

1) Use the Chilkat Unicode API which uses wchar_t: http://www.chilkatsoft.com/refdoc/wcpp.asp

2) Pass utf-8 strings to the Chilkat multibyte API: Utf8 C++ property allows for utf-8 or ANSI “const char *” Also, CkString can be helpful. See http://www.example-code.com/vcpp/string.asp