Archived Forum Post

Index of archived forum posts

Question:

unzipToString skips the last character in the string?

Jul 09 '13 at 14:41

While using CkZip and CkZipEntry's unzipToString to open the docProps/custom.xml from a Microsoft Word document, I noticed that the last character in the Xml is missing for some reason.

The code is somewhat like this:

CkZipEntry *zipentry = zip.GetEntryByName(_T("docProps/custom.xml"));
const char *charXml = zipentry->unzipToString(0, _T("utf-8"));

The character that is missing is the ending ">" of the "<Properties>" node.

My environment is VC++ 11 and Chilkat v4 (obviously) in win32 mode.


Answer

Please check to see if this new build contains the same problem:

32-bit: http://www.chilkatsoft.com/preRelease/chilkat-9.4.1-x86-vc11.zip

64-bit: http://www.chilkatsoft.com/preRelease/chilkat-9.4.1-x86_x64-vc11.zip


Answer

Now I am suddenly faced with another problem while getting the ZipEntry to process:

ChilkatLog:
  GetEntryByName:
    DllDate: Apr 10 2013
    ChilkatVersion: 9.4.1.0
    UnlockPrefix: XXXXXXXX
    Username: XXXX:XXXXXX
    Architecture: Little Endian; 32-bit
    VerboseLogging: 0
    filename: docProps/custom.xml
    File not found in zip archive
  --GetEntryByName
--ChilkatLog

The code worked fine in 9.4.0:

CkZipEntry *entry = zip.GetEntryByName(_T("docProps/custom.xml"))

The entry above is null/empty, but it does exist in the zip file. Here is the zip content as XML:

<zip_contents>
    <dir name="_rels">
        <file>.rels</file>
    </dir>
    <dir name="word">
        <dir name="_rels">
            <file>document.xml.rels</file>
            <file>header2.xml.rels</file>
        </dir>
        <dir name="theme">
            <file>theme1.xml</file>
        </dir>
        <dir name="media">
            <file>image1.png</file>
        </dir>
        <file>document.xml</file>
        <file>endnotes.xml</file>
        <file>fontTable.xml</file>
        <file>footer1.xml</file>
        <file>footer2.xml</file>
        <file>footer3.xml</file>
        <file>footnotes.xml</file>
        <file>header1.xml</file>
        <file>header2.xml</file>
        <file>header3.xml</file>
        <file>numbering.xml</file>
        <file>settings.xml</file>
        <file>styles.xml</file>
        <file>webSettings.xml</file>
    </dir>
    <dir name="docProps">
        <file>app.xml</file>
        <file>core.xml</file>
        <file>custom.xml</file>
    </dir>
    <file>[Content_Types].xml</file>
</zip_contents>

Answer

I'm facing the same issue: unzipToString is missing the last character.

But the download links above are not working. Where can I get the fixed version for .NET 4.0?


Answer

Looks like Chilkat just released the newer version and that's why the links above no longer work. All is well :o)