1
votes

I've had GWT, ext-GWT web-project in utf-8 charset. I've also add utf-8 charset in html file.

Additionally I need to create some pdf report. So that I wrote a special servlet, which take a template html-file, add some information (in local language) and convert a new generated html-file to pdf-file with wkhtmltopdf.

Now, when I try to convert that generated html-file (which also had <meta charset="UTF-8">) to pdf-file, information with local language (some Strings), which I send from client code to servlet is replacing in the result pdf-file with "?" symbol in a black rhomb.

To solve this problem I add some parameters to Process Builder such as "--encoding" "utf-8":

private void ConvertHTMLtoPDF(String sConvertationProgramm, String sHTML, String sPDF)
{
    try {
        ProcessBuilder pb = new ProcessBuilder(sConvertationProgramm, "--encoding", "utf-8", sHTML, sPDF);
        Process process = pb.start();
        process.waitFor();
    } catch (Exception e) {
        e.printStackTrace();
    }

}

but all the same, there is no effect at all. At the same time I have those symbols only on tomcat server, without same trouble at jetty.


So, Where is the problem, on the sending local information to the server (cause another information in a local language from template html-file is showed correctly) or when it's writing/converting at the server side?

Does anyone has any suggestions? Thanks

1

1 Answers

1
votes

I found my problem. And I have to give my apologises for everyone, because my problem was in the writing new generated html, so instead of using this:

BufferedReader br = new BufferedReader(new InputStreamReader(fis));
BufferedWriter bw = new BufferedWriter(new FileWriter(fHTML));

I must use this:

BufferedReader br = new BufferedReader(new InputStreamReader(fis,"UTF8"));
BufferedWriter bw  = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fHTML), "UTF-8"));

So, the problem was on reading/writing html-files.