Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1023 (new defect)

Opened 5 months ago

Last modified 2 months ago

io.archive.Zip.createArchive failed when (MBCS)Chinese file name

Reported by: yidabu Assigned to: DRK
Priority: normal Milestone: 0.99.8
Component: Core Functionality Version: 0.99.5 Jascha
Keywords: Zip triage Cc: yidabu

Description

1. zip archive created by io.archive.Zip, when uncompress by WinRAR, report error:

Unexpected end of archive

2. createArchive failed when (MBCS)Chinese file name:

    char[][] files = [r"D:\chinese中文.txt"];
    createArchive(r"D:\test.zip", Method.Deflate, files);

Exception:

object.Exception: cannot encode character "20013" in codepage 437.

I used Phobos version, have not this issue.

Change History

04/05/08 07:40:37 changed by larsivi

  • owner changed from kris to DRK.

are you able to debug this so we can get a source line?

04/05/08 19:26:20 changed by yidabu

I debug the code above by ddbg, say:

Unhandled exception in Ddbg 0.11.3 beta:
test: 鎷掔粷璁块棶銆?

Please report this problem!
See the http://ddbg.mainia.de/releases.html for details.
Thank you!

the path(file name) in archive in local encode format maybe fix this issue.

04/05/08 21:23:53 changed by yidabu

I use this code to check the path is ASCII character only:

    // bugs with tango.io.archive.Zip, MBCS(e.g. Chinese) in path is not supported
    bool isAscii(char[] str)
    {
        foreach(c; str)
            if(c>127) 
                return false;
        return true;
    }    
    
    foreach (file; scan.files) 
        if(isAscii(file.toString))
            files ~= file.toString;

    createArchive(r"test.zip", Method.Deflate, files);

04/27/08 05:19:52 changed by larsivi

  • milestone changed from 0.99.6 to 0.99.7.

05/10/08 18:37:38 changed by larsivi

Hmm, it seems like the Zip spec implemented use Codepage 437 internally, and the problem then is that the chinese characters out of range - I doubt that really is unhandled though, but maybe it needs to go via the local codepage to work? It would be nice with some information/links on how this is meant to work - if anyone knows where to find it.

05/19/08 17:52:35 changed by yidabu

debug the code above: ddbg createzip.exe

output is:

Unhandled exception in Ddbg 0.11.3 beta:
test: Access is denied.

Please report this problem!
See the http://ddbg.mainia.de/releases.html for details.
Thank you!

05/20/08 03:45:49 changed by larsivi

How is ddbg's failure relevant to this ticket? It is not the information needed to resolve it. The error message you get is understandable, what is not is how to make non-ascii, non-western characters encodable to codepage 437, or some other format that zip files will accept. It must be possible to dig out information on this.

05/24/08 14:46:26 changed by larsivi

  • keywords changed from Zip to Zip triage.

06/08/08 10:05:54 changed by larsivi

Seems like this issue is related to the UTF-8 TODO at the top of this file. Relevant information to resolve that would be this:

http://www.pkware.com/documents/casestudies/APPNOTE.TXT

Also, possibly relevant if wider codepage support is needed -

http://www.chilkatsoft.com/p/p_453.asp

07/10/08 06:54:38 changed by larsivi

  • milestone changed from 0.99.7 to 0.99.8.