[opencms-dev] Properties files and UTF-8 characters
Christoph Fröhlich
cfauto at folge2.de
Wed Jan 30 10:20:26 CET 2013
We use Springs ReloadableResourceBundleMessageSource along with a custom message tag. The site is available in german and english and we plan to add turkish and russian in the near future. Property files are encoded in utf-8. We do not encode non ascii characters like - for example - german umlauts. We write "ü" and "ä" and so on
Regards
christoph
Am 30.01.2013 um 08:56 schrieb Ladislav Kulhanek <ladislav.kulhanek at gmail.com>:
> 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: [Bulk] 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
>
>
>
>
>
> _______________________________________________
> 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/aecf08d5/attachment.htm>
More information about the opencms-dev
mailing list