[opencms-dev] Properties files and UTF-8 characters

Olli Aro olli_aro at yahoo.co.uk
Wed Jan 30 10:11:03 CET 2013


Thanks Ladislav,

 

Yes this is probably the best approach.

 

In case anyone is interested. Found a good free text editor to do the job:

 

http://www.babelstone.co.uk/software/babelpad.html

 

Regards,

 

Olli

 

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Ladislav Kulhanek
Sent: 30 January 2013 07:56
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Properties files and UTF-8 characters

 

Hi,

you should write non ISO-8859-1 characters as \uXXXX. More id detail here: http://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle

There are text editors for Eclipse (and I suppose for other IDEs too), which do this automatically.

Cheers,

Ladislav

 

2013/1/29 Olli Aro <olli_aro at yahoo.co.uk>

Thanks Paul,

 

Yeah, I ended up doing something similar the last time around.

 

Just keep wondering how the workplace property files work fine? For example, surely there should be the same issue with the German translation of the workplace?

 

Olli

 

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Paul-Inge Flakstad
Sent: 29 January 2013 15:42
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Properties files and UTF-8 characters

 

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

 

 

 


_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev





 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130130/bf8d450e/attachment.htm>


More information about the opencms-dev mailing list