I am trying to figure out how to write the registered trademark '®' and copyright character '©' to the archive comment for a zip file. This is not a comment for the ZipEntry, although the solution may be similar; but, rather, the whole zip file comment.
I have tried a lot of different things; but, at the end of the day, the setComment() method on the JarOutputStream (which extends ZipOutputStream) writes a "circumflex a" (i.e., an 'Â') before the extended ASCII characters.
So, instead of:
MySoftware®
Copyright © 2011
I get:
MySoftware®
Copyright © 2011
when viewing the archive comments using WinZip or PKZIP or 7-ZIP or any other archive tool I have tried.
I have tried converting to Unicode; but, since the setComment() implementation only writes single bytes, I get a literal '\u00A9'
string in the comment.
Does anyone have a solution for this? Or know how to write the comments to a zip file without using the setComment() method (appending the comment directly to the end of the file)? I have tried the latter, but I am somehow corrupting the archive when doing so.
I know that I could simply use '(R)' and '(c)' instead, but I would rather use the extended ASCII characters, as they look better. I also know that this can be done via WinZip's command line utility; but I would like to use
Java so I don't have to buy a zip license just to add an archive comment to a jar file.
Thank you in advance for any help you can offer.