Jump to content
We've recently updated our Privacy Statement, available here ×

Export CSV File with UTF-8 Encoding


aegleston

Recommended Posts

Hi,

We use JasperServer 3.0 (will be upgrading soon to 3.5).  We are trying to export a csv type report with UTF-8 encoding.  The file appears to be ANSI encoded every time.  So far we have:

1) Set the URIEncoding = "UTF-8" in the server.xml file in $TOMCAT_BASE/conf.

2) Added the following line in $TOMCAT_BASE/webapps/jasperserver/WEB-INF/classes/jasperreports.properties:

net.sf.jasperreports.export.character.encoding=UTF-8

I have searched the forums for JasperServer, iReport and JasperReports.

Is there a way to make the csv file use UTF-8 encoding?

Thanks.

Andy

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

I am not sure.  Here is what I did.  I downloaded the .csv report from our JasperServer website onto my Windows machine.  I then viewed the character encoding in Firefox by changing. csv to .html and navigating to View and Character Encoding.  This showed ISO-8859-1.  I then viewed the file in TextPad.  Textpad seemed to think the file was ANSI encoded.

So it seems not to be a UTF-8 encoded file but I don't know for sure.

Andy



Post Edited by aegleston at 12/16/2009 15:48
Link to comment
Share on other sites

  • 2 weeks later...

According to Textpad the file is still ANSI encoded.  I'm probably the one missing the point here.  How do you know the file is UTF-8 encoded?  Please note I had to remove any columns (in the report definition) with text because they contained customer data.  When this report goes into production it will contain text columns with names and email addresses.

Thanks.

Andy

Link to comment
Share on other sites

UTF-8 is compatible with ASCII, i.e. characters in the ASCII set have the same encoding in ASCII and UTF-8.  So if you have a file that contains only characters from the ASCII set, there won't be any difference between its ASCII and UTF-8 representations.

If you want to check that the file is UTF-8 encoded, include a non-ASCII character in it.

Regards,

Lucian

PS:  UTF-8 files can have a BOM character at the beginning as a hint on the encoding, but that can cause problems in certain situations so JS does not use it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...