[opencms-dev] Properties files and UTF-8 characters
Paul-Inge Flakstad
flakstad at npolar.no
Tue Jan 29 16:42:24 CET 2013
Hi Olli,
Can't say if there have been improvements on this in OpenCms, but I faced the same issue some time ago, working on a site with content in Russian.
My solution was: instead of the "normal" CmsJspActionElement.html#label(java.lang.String) method, I used this one:
public String labelUnicode(String key) {
try {
return new String(this.label(key).getBytes("ISO-8859-1"), "UTF-8");
} catch (java.io.UnsupportedEncodingException e) {
// Really shouldn't occur
return null;
}
}
(Above method is part of a convenience class extending CmsJspXmlContentBean.)
Not the best solution, but it's simple and it works.
Cheers,
Paul
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 29. januar 2013 16:27
To: opencms-dev at opencms.org
Subject: [opencms-dev] Properties files and UTF-8 characters
Hi all,
It has been a while since I last had to deploy OpenCms based on language relying on UTF-8.
I would like to use the property files as part of my templates, but it still looks as UTF-8 property files are still no no in Java.
Before I write my own version of org.opencms.i18n.CmsPropertyResourceBundle class (like I did last time), I was wondering if there was some other way to get around this?
I am just thinking maybe I am missing something, since the workplace localisation is also in property files and works fine eg. in German?
Anyone have any pointers on how to use UTF-8 based property file as part of your site templates?
Thanks,
Olli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130129/812b110e/attachment.htm>
More information about the opencms-dev
mailing list