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

I18n with UTF-8 charset


matienzar

Recommended Posts

Hello,

 

 From java applications, we have properties files with UTF-8 charset. When we want to use these properties files with ireport, we have problem with characters like "áéíóú", because ireport reads it in ISO-8851.

 

what can we do?

 

Lot of thanks

 

 

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

It's to say. We have a J2EE application with UTF-8 charset, with .properties with utf8 format, and we would like to use these properties files with jasper too, but jasperreports works with latin1 how java properties api say.

We have 2 solutions:

- Change charset of the application to UTF-8

- Working with to properties files, one in latin1 and another in utf-8

 

My question, is it the right way?

 

Lot of thanks

Link to comment
Share on other sites

Well, the solution you choose depends on the architecture of your application.

If you want to use the default JasperReports resource bundle support (which relies on java.util.ResourceBundle and property files), you'll need to have Latin-1 properties file with Unicode escapes.  This can be achieved in several ways, for instance by using native2ascii at build time to transform the property files.

Another option is to take the resource bundle loading into your own hands, load the UTF-8 property files as java.util.ResourceBundle instances and pass such instances to the reports via the REPORT_RESOURCE_BUNDLE parameter.  You can find some ideas on how to load UTF-8 property files as resource bundles on the Java forums, see for example http://www.thoughtsabout.net/blog/archives/000044.html or the java.util.ResourceBundle.Control class introduced in Java 1.6.

Regards,

Lucian

Link to comment
Share on other sites

  • 10 years later...

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...