Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character encoding error when creating new spreadsheet #253

Open
pnemonic78 opened this issue Sep 21, 2023 · 2 comments
Open

Character encoding error when creating new spreadsheet #253

pnemonic78 opened this issue Sep 21, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@pnemonic78
Copy link

Error exporting: java.nio.charset.CharsetICU[UTF-8]
  java.nio.charset.IllegalCharsetNameException: java.nio.charset.CharsetICU[UTF-8]
  at java.nio.charset.Charset.checkCharsetName(Charset.java:201)
  at java.nio.charset.Charset.forName(Charset.java:295)
  at org.apache.commons.compress.archivers.zip.ZipEncodingHelper.getZipEncoding(ZipEncodingHelper.java:58)
  at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.<init>(ZipArchiveInputStream.java:431)
  at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.<init>(ZipArchiveInputStream.java:408)
  at org.odftoolkit.odfdom.pkg.ZipHelper.createZipInputStream(ZipHelper.java:61)
  at org.odftoolkit.odfdom.pkg.ZipHelper.entriesToMap(ZipHelper.java:81)
  at org.odftoolkit.odfdom.pkg.OdfPackage.readZip(OdfPackage.java:529)
  at org.odftoolkit.odfdom.pkg.OdfPackage.initializeZip(OdfPackage.java:509)
  at org.odftoolkit.odfdom.pkg.OdfPackage.<init>(OdfPackage.java:318)
  at org.odftoolkit.odfdom.pkg.OdfPackage.loadPackage(OdfPackage.java:389)
  at org.odftoolkit.odfdom.doc.OdfDocument.loadTemplate(OdfDocument.java:180)
  at org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument.newSpreadsheetDocument(OdfSpreadsheetDocument.java:79)
@pnemonic78
Copy link
Author

pnemonic78 commented Sep 21, 2023

Suggestion:

replace in ZipHelper
return new ZipArchiveInputStream(is, StandardCharsets.UTF_8.toString(), true, true);
with
return new ZipArchiveInputStream(is, StandardCharsets.UTF_8.name(), true, true);

@svanteschubert
Copy link
Contributor

Nice catch! Thank you!
Do you have some simplified test document to reproduce the issue?
Most welcome would be a patch of yours where there is a test involved that earlier fails and with your patch would be working!
Thanks in advance!

Greetings from the LibreOffice Conference in Bukarest! :-)
Svante

@svanteschubert svanteschubert added the bug Something isn't working label Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants