File names with Japanese characters turn to garbage when written to a zip file using java.util.zip.*

后端 未结 3 1670
粉色の甜心
粉色の甜心 2021-01-20 11:00

I have a directory with a name that contains Japanese characters, and I need to use the zip utils in java.util.zip to write it to a zip file. Writing the zip file succeeds,

3条回答
  •  迷失自我
    2021-01-20 11:38

    TrueZIP claims to do this better:

    The J2SE API always uses UTF-8 (eight bit Unicode character set) for entry names and comments instead of CP437 (a.k.a. IBM437, the genuine IBM-PC character set), which is used by the de-facto standard PKZIP from PKWARE. As a result, you cannot read or write ZIP files with international entry file names such as e.g. "täscht.txt" in a ZIP file created by a (southern) German.

    [description of other problems omitted]

    The TrueZIP Library has been developed to overcome these limitations/disadvantages.

提交回复
热议问题