We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Sample code to reproduce problem:
public static void main(String[] args) throws Exception { System.out.println(System.getProperty("file.encoding")); Path templatePath = Paths.get("C:\\Temp\\template.docx"); Path reportPath = Paths.get("C:\\Temp\\report.docx"); byte[] templateBytes = Files.readAllBytes(templatePath); InputStream templateInputStream = new ByteArrayInputStream(templateBytes); IXDocReport template = XDocReportRegistry.getRegistry() .loadReport(templateInputStream, "test", TemplateEngineKind.Velocity); try (OutputStream out = Files.newOutputStream(reportPath)) { IContext context = template.createContext(); template.process(context, out); } }
template.docx
This code with JVM option -Dfile.encoding=CP1251 produces report with broken encoding.
-Dfile.encoding=CP1251
Template content:
Expected result:
Actual result:
Problem was fixed for me when I started to use encoding parameter in method getResourceReader of class XDocReportEntryResourceLoader
getResourceReader
Instead of line return new InputStreamReader(inputStream); I used return new InputStreamReader(inputStream, Charset.forName(encoding));
return new InputStreamReader(inputStream);
return new InputStreamReader(inputStream, Charset.forName(encoding));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Sample code to reproduce problem:
template.docx
This code with JVM option
-Dfile.encoding=CP1251
produces report with broken encoding.Template content:
Expected result:
Actual result:
Problem was fixed for me when I started to use encoding parameter in method
getResourceReader
of class XDocReportEntryResourceLoaderInstead of line
return new InputStreamReader(inputStream);
I usedreturn new InputStreamReader(inputStream, Charset.forName(encoding));
The text was updated successfully, but these errors were encountered: