I have a java file in Eclipse that is in UTF-8 and has some strings containing accents.
In the java file itself, the accent is written and saved as é .
In the xml that is generated using velocity the é becomes é
In the pdf that is generated using fop and and an xsl template, the output is displayed as é
So this is probably an encoding issue and everything should be in UTF-8. What’s weird is that locally in my eclipse environment (windows) where I run the application, the whole process works and the correct accents é are displayed in the pdf.
However when the application is built with maven and deployed to a (unix environment) I see the problem described above.
Perhaps Eclipse is compiling the file with a different
javaccommand line than Maven.When you compile Java, you have to tell the compiler the encoding of the source files (if they contain non-ASCII characters and the default doesn’t work).
I think the way to fix this in Maven is to add this to your pom.xml file:
(I got that from a Maven FAQ about a slightly different issue.)
You could instead avoid the encoding issue entirely by using ugly Unicode escape sequences in your Java file.
éwould become\u00e9. Worse for humans, easier for the toasters. (As Perlis said, “In man-machine symbiosis, it is man who must adjust: The machines can’t.”)