• UnsupportedEncodingException in Jasper Reports

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #18464  by noxious
 
Hello, I'm using iReport designer 3.5.6 to create jrxml reports for my okm application.
I had a problem in creating pdf reports with UTF-8 characters but after a lot of googling I found out that I had to import Arial Unicode MS font in my ireport designer with pdfEncoding=Identity-H. Then, when I have to display a UTF-8 text,
I just write:
Code: Select all
<font fontName="Arial Unicode MS" size="22" isBold="true" isPdfEmbedded="true" pdfEncoding="Identity-H"/>
Everything works perfect when I use iReport's default host but when I try to run the report using OpenKM, I get UnsupportedEncodingException for Encoding Identity-H.
Do I have to install Arial Font or jasperreports-fonts-3.5.6.jar somewhere inside OpenKM server?Where?
 #18466  by jllort
 
This tag in unknown by me. If you do not add in your jasper report which error message do you get in server. Normally simply installing in your server MS core fonts. In ubuntu is something like apt-get install msttcorefonts ( I never need to use this tag for it ).
 #18468  by noxious
 
Jllort you misunderstood me. The tag I embedded is written inside my jrxml file. I use it to specify the font style of my text.
So every time I want to print a UTF-8 text inside my report I just specify that the text font will be Arial Unicode MS and the pdfEncoding will be Identity-H.
Code: Select all
<staticText>
<reportElement x="225" y="0" width="297" height="44"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial Unicode MS" size="22" isBold="true" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA["Here goes my UTF-8 text"]]></text>
</staticText>
This works when I execute the jrxml report using iReport, because I imported Arial font inside iReport. However, when I execute the jrxml file using OpenKM I get UnsupportedEncodingException. Apparently, I have to intsall Arial font somewhere inside jboss server folders, but I don't know where.I'm using windows 7 and the issue is only for pdf format.
 #18469  by noxious
 
I solved it finally using other font style in my jrxml file:
Code: Select all
			
<staticText>
<reportElement x="225" y="0" width="297" height="44"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="22" isBold="true" />
</textElement>
<text><![CDATA[Αρχείο Σημάτων 114 ΠΜ]]></text>
</staticText>
DejaVu Sans works perfect with UTF-8 chars and no problem at pdf reports either :D.
 #18476  by jllort
 
You can install as I told ms core fonts in server or simply add font to java ( google search for add java font in java virtual machine under your os , really is not jboss where should be placed the font or you install on server or install under JVM ). Hope this could be useful to you in future.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.