开发者

Java, Archives, Linux & Cyrillic

开发者 https://www.devze.com 2023-02-15 12:07 出处:网络
I try to write an archiver in java, that creates TAR or ZIP archives, with correctly cyri开发者_C百科llic file names, then it opened in linux.

I try to write an archiver in java, that creates TAR or ZIP archives, with correctly cyri开发者_C百科llic file names, then it opened in linux. In windows I use org.apache.tools.zip, from ant:

ZipOutputStream.setEncoding("cp866"); 

to get it, but file roller (archive manager) in linux don't understand it. In org.apache.tools.tar method setEncoding() isn't exists. Also I try to use some other encoding, that supports Cyrillic, such a cp1251, utf-8, koi-8r but it gaves no result.


Your file may be creating the files correctly and the problem lies on file-roller. It's known that it can't detect filename's encoding. See here and here.

Attempt to use unzip(filenames will probably be garbled) or p7zip directly from the shell (there is also a java version - j7zip).

7zip works for me, with utf8 encoding of Cyrillic characters. File roller, Ark, and all others that in fact execute unzip will corrupt the filenames in my system.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号