Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help required regarding special character representation in PDF generated using FOP

 
anekh sunamo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using FOP version 0.20.5 for generating a PDF. Whenever a special character is encountered, they are getting displayed as hash ("#") in the PDF. Can anyone give an idea how to go about this.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which font are you using in the generated PDF? Does that font have the special character your input file uses?
 
anekh sunamo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using sans-serif font. We are getting the special char from word document. for example: "This is � the special char" The hypen we get from word document is not the mormal ANSI hypen. This seems to be a double byte char. And the Hypen is displayed as # in PDF. We are using FOP.jar for pdf generation.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. So apparently the default sans-serif font (sans-serif is just a "family" of fonts, if you weren't aware of that) used by FOP doesn't handle your specific special character too well. Could you try another font?
 
anekh sunamo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We tried with fonts like Arial, Courier but the special characters remained same.
Now we passed UTF-8 encoding to the InputStreamReader. Looks like it works but generates an extra character - �.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic