HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Troubleshooting › Problem rendering UTF-8 pages..
- This topic has 1 reply, 1 voice, and was last updated Sep 10, 2009
22:17:00 byrvanderwerf.
-
AuthorPosts
-
September 10, 2009 at 20:59#26266
Hi I am using the Pro version Java API trying to render a UTF-8 page. I am calling a JSP page from a java class, and I have verified my page has both the tag for utf-8 as well as the jsp encoding type set properly as well. When I enable debugging, however, I get the following output:
not yet in cache: java:fonts/pd4fonts.properties
using content encoding from HTTP header: UTF-8
new parse attempt with: ISO8859_1
not yet in cache: java:fonts/arial.ttf
read ‘arial’ from java:fonts/arial.ttf
not yet in cache: java:fonts/arialbd.ttf
read ‘arial bold’ from java:fonts/arialbd.ttfI can’t figure out where the ISO8859_1 is coming from. I verified my system property ‘file.encoding’ is also set to UTF-8. All my UTF-8 characters come out as junk on the page. The same page from a browser renders correctly, but incorrectly in the PDF.
This is my code:
java.io.FileOutputStream fos = new java.io.FileOutputStream(outputPDFFile);
PD4ML pd4ml = new PD4ML();
HttpSession session = request.getSession();
session.setAttribute(RequestAttributeNames.USER_ATTRIBUTE, session.getAttribute(RequestAttributeNames.USER_ATTRIBUTE));
pd4ml.useServletContext(request.getSession().getServletContext());
pd4ml.setSessionID(request.getSession().getId());Cookie[] cookies = request.getCookies();
for(Cookie cookie: cookies){
pd4ml.setCookie(cookie.getName(), cookie.getValue());
}pd4ml.setPageInsets(new Insets(40, 20, 40, 20));
pd4ml.setHtmlWidth(950);
pd4ml.enableDebugInfo();pd4ml.useTTF( “java:fonts” true );
pd4ml.setDefaultTTFs(“Times New Roman”, “Arial”, “Courier New”);
}
pd4ml.render(“http://blah.jsp”, fos);
fos.close();Is there any way to see what the debug message ‘new parse attempt with: ISO8859_1’ is coming from? Without the source of the library it’s hard to tell what is going on.
Ryan
September 10, 2009 at 22:17#27542I found the problem, it was not with my library but an errant tag that was setting the charset to 8859-1, which was confusing pd4ml. After correcting that my utf-8 characters are now correct.
-
AuthorPosts
The forum ‘Troubleshooting’ is closed to new topics and replies.
