HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › Encoding problem (æøå) › Re: Re: Encoding problem (æøå)
new parse attempt with: UTF8
is caused by an encounter with encoding directive.
In your code overrideDocumentEncoding() takes no effect, as if works only for render(URL) methods.
[language=java:2s69vyt0]/**
* sets default encoding for URL-addressed HTML documents
* @param encoding name
* @since v3.7.1
*/
public void overrideDocumentEncoding( String encoding ) {[/language:2s69vyt0]
As long as you pass the HTML source as an InputStreamReader, it uses a charset of the reader. You may try to use InputStreamReader constructor with Carset parameter. But a better approach would be to call
render(StringReader isr, OutputStream os, URL base, String encoding)
> But the characters like æøå is supported by ISO-8859-1.
Obviously the problem is caused by an attempt to interpret ISO-8859-1 document as UTF-8. First we need to make sure it is parsed as ISO-8859-1. Please try the above suggestions.