1
I am trying to print the content of webview in javafs 2.2, in windows and non-functional special characters, (accented vowels, ç...) already changed the charset of the application as follows:
public static void main(String[] args) {
System.setProperty("file.encoding","UTF-8");
Field charset = null;
try {
charset = Charset.class.getDeclaredField("defaultCharset");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
charset.setAccessible(true);
try {
charset.set(null,null);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
TagSellApp.launch( args );
}
also when I write the file to load into webview, in this case I get a provided Document from the org.jsoup library:
private void initializeWebView(Document document) {
File file = new File(".tmp/poster.html");
try {
FileWriter rec = new FileWriter(file);
PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file, false), StandardCharsets.UTF_8));
writer.println(document.outerHtml());
writer.close();
rec.close();
webEngine.load( file.toURI().toURL().toString() );
} catch (IOException ex) {
ex.printStackTrace();
}
webEngine.reload();
}
before this when I load Document I also:
html.charset( StandardCharsets.UTF_8 );
And even then, none of this works in windows, I tried other encoding like Cp1252m Iso 8859-1 and the damned windows does not work... to some days researching solutions I’ve done numerous tests someone has already gone through it and have the solution? Thank you in advance!
Have you tried using Javafx version 8? If so, try changing "Standardcharsets.UTF_8" to "UTF_8" with quotes
– Gustavo Fragoso
tried also... was noticing at this time that the problem and with the custom fonts... there are some custom fonts in css in webview ta everything normal the problem happens at the time of printing same
– Marcus Vinicius