You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cristian Peraferrer <co...@gmail.com> on 2009/04/09 11:28:29 UTC

[s2] Using UTF-8 in .properties files

Hi,

How I can use UTF-8 in the .properties files? (I need the .properties  
files for i18n, so loggically I will need characters other than the  
contained in ASCII or latin1).

Thanks,
Cristian.

-- 
GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [s2] Using UTF-8 in .properties files

Posted by Muthu Velappan <mu...@aspiresys.com>.
Christian,

You can create a properties file with display text in required language
itself like 

Newkey.label1 = Gracias
...
...

Save it to <somefile.txt> and then call native2ascii program in
<JAVA_HOME>/bin folder to convert the contents to appropriate Unicode
characters and save the file with appropriate properties file naming
convention. In the example, it will be <somefile_es.properties>.

You can also automate this file generation build script too. Hope this
helps.

~Muthu

-----Original Message-----
From: Charlesmel Carino [mailto:charlesmel1974@yahoo.com] 
Sent: Thursday, April 09, 2009 7:46 PM
To: Struts Users Mailing List
Cc: Rommel Garcia
Subject: Re: [s2] Using UTF-8 in .properties files

Hi Christian,

There are two sides of the story here. 

One is to type those UTF-8 characters onto your properties file (probably
several combination of key strokes) and make sure that file editor you are
using
is configured for encoding UTF-8.

The other is ensuring your code to read UTF-8 encoded files. If that is not
happening then your characters get funky.

Rommel



________________________________
From: Cristian Peraferrer <co...@gmail.com>
To: user@struts.apache.org
Sent: Thursday, April 9, 2009 5:28:29 AM
Subject: [s2] Using UTF-8 in .properties files

Hi,

How I can use UTF-8 in the .properties files? (I need the .properties files
for i18n, so loggically I will need characters other than the contained in
ASCII or latin1).

Thanks,
Cristian.

--GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [s2] Using UTF-8 in .properties files

Posted by Charlesmel Carino <ch...@yahoo.com>.
Hi Christian,

There are two sides of the story here. 

One is to type those UTF-8 characters onto your properties file (probably several combination of key strokes) and make sure that file editor you are using
is configured for encoding UTF-8.

The other is ensuring your code to read UTF-8 encoded files. If that is not happening then your characters get funky.

Rommel



________________________________
From: Cristian Peraferrer <co...@gmail.com>
To: user@struts.apache.org
Sent: Thursday, April 9, 2009 5:28:29 AM
Subject: [s2] Using UTF-8 in .properties files

Hi,

How I can use UTF-8 in the .properties files? (I need the .properties files for i18n, so loggically I will need characters other than the contained in ASCII or latin1).

Thanks,
Cristian.

--GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

Aw: Re: Aw: [s2] Using UTF-8 in .properties files

Posted by ki...@arcor.de.
It is definitely possible to develop non-English applications using resource bundles. 
I typically put the Unicode codes (\uxxxx) in the .properties files when developing apps which must support e. g. cyrillic text. This is not as comfortable as it could be, but there are web based converters from non-ASCII text to unicode code sequences. And then: copy & paste.

If you have to deal with a lot of text, it might be worthwhile to look for ResourceBundle extensions capable of real Unicode text.

Martin


----- Original Nachricht ----
Von:     Cristian Peraferrer <co...@gmail.com>
An:      Struts Users Mailing List <us...@struts.apache.org>
Datum:   09.04.2009 11:52
Betreff: Re: Aw: [s2] Using UTF-8 in .properties files

> So, is it possible to *really* develop internationalized struts web  
> apps? How can I add chinese or japanese, if the way to  
> internationalize it isn't capable to use other encoding than ASCII? I  
> can't understand that.
> 
> Any idea?
> 
> Thanks,
> Cristian.
> 
> On 09/04/2009, at 11:39, kindlerm@arcor.de wrote:
> 
> > If you look in the Java docs, you will see this is not  
> > possible. .properties files are always ASCII. The only possibility  
> > to include non-ASCII characters is using the Unicode codes \uxxxx. I  
> > do hate this.
> >
> > There might be a way to extend the resource bundle framework to  
> > support files using other encodings, but I never found a ready-to- 
> > use package and writing it myself was never worthwhile.
> >
> > Martin
> >
> >
> > ----- Original Nachricht ----
> > Von:     Cristian Peraferrer <co...@gmail.com>
> > An:      user@struts.apache.org
> > Datum:   09.04.2009 11:28
> > Betreff: [s2] Using UTF-8 in .properties files
> >
> >> Hi,
> >>
> >> How I can use UTF-8 in the .properties files? (I need the .properties
> >> files for i18n, so loggically I will need characters other than the
> >> contained in ASCII or latin1).
> >>
> >> Thanks,
> >> Cristian.
> >>
> >> -- 
> >> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> -- 
> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Aw: [s2] Using UTF-8 in .properties files

Posted by redstun <re...@gmail.com>.
What about this way
1. use UTF-8 properties file and directly put plain Unicode characters in
it.
2. during your build, add a post build step to call native2ascii and convert
all the properties files to have Unicode characters escaped.

the post build step should be easy to implement with ANT/Maven, even in
Eclipse it should be possible to customize the project builders to add this
extra step.

-redstun

On Thu, Apr 9, 2009 at 17:52, Cristian Peraferrer <co...@gmail.com>wrote:

> So, is it possible to *really* develop internationalized struts web apps?
> How can I add chinese or japanese, if the way to internationalize it isn't
> capable to use other encoding than ASCII? I can't understand that.
>
> Any idea?
>
> Thanks,
> Cristian.
>
>
> On 09/04/2009, at 11:39, kindlerm@arcor.de wrote:
>
>  If you look in the Java docs, you will see this is not possible.
>> .properties files are always ASCII. The only possibility to include
>> non-ASCII characters is using the Unicode codes \uxxxx. I do hate this.
>>
>> There might be a way to extend the resource bundle framework to support
>> files using other encodings, but I never found a ready-to-use package and
>> writing it myself was never worthwhile.
>>
>> Martin
>>
>>
>> ----- Original Nachricht ----
>> Von:     Cristian Peraferrer <co...@gmail.com>
>> An:      user@struts.apache.org
>> Datum:   09.04.2009 11:28
>> Betreff: [s2] Using UTF-8 in .properties files
>>
>>  Hi,
>>>
>>> How I can use UTF-8 in the .properties files? (I need the .properties
>>> files for i18n, so loggically I will need characters other than the
>>> contained in ASCII or latin1).
>>>
>>> Thanks,
>>> Cristian.
>>>
>>> --
>>> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
>>>
>>>

Re: Aw: [s2] Using UTF-8 in .properties files

Posted by Cristian Peraferrer <co...@gmail.com>.
Thank you very much, I think it resolves my problem :)

Cristian.

On 09/04/2009, at 12:28, Paweł Wielgus wrote:

> Hi all,
> try this:
> http://sourceforge.net/projects/eclipse-rbe/
>
> Best greetings,
> Paweł Wielgus.
>
>
> 2009/4/9 Cristian Peraferrer <co...@gmail.com>:
>> So, is it possible to *really* develop internationalized struts web  
>> apps?
>> How can I add chinese or japanese, if the way to internationalize  
>> it isn't
>> capable to use other encoding than ASCII? I can't understand that.
>>
>> Any idea?
>>
>> Thanks,
>> Cristian.
>>
>> On 09/04/2009, at 11:39, kindlerm@arcor.de wrote:
>>
>>> If you look in the Java docs, you will see this is not possible.
>>> .properties files are always ASCII. The only possibility to include
>>> non-ASCII characters is using the Unicode codes \uxxxx. I do hate  
>>> this.
>>>
>>> There might be a way to extend the resource bundle framework to  
>>> support
>>> files using other encodings, but I never found a ready-to-use  
>>> package and
>>> writing it myself was never worthwhile.
>>>
>>> Martin
>>>
>>>
>>> ----- Original Nachricht ----
>>> Von:     Cristian Peraferrer <co...@gmail.com>
>>> An:      user@struts.apache.org
>>> Datum:   09.04.2009 11:28
>>> Betreff: [s2] Using UTF-8 in .properties files
>>>
>>>> Hi,
>>>>
>>>> How I can use UTF-8 in the .properties files? (I need  
>>>> the .properties
>>>> files for i18n, so loggically I will need characters other than the
>>>> contained in ASCII or latin1).
>>>>
>>>> Thanks,
>>>> Cristian.
>>>>
>>>> --
>>>> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> --
>> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

-- 
GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Aw: [s2] Using UTF-8 in .properties files

Posted by Paweł Wielgus <po...@gmail.com>.
Hi all,
try this:
http://sourceforge.net/projects/eclipse-rbe/

Best greetings,
Paweł Wielgus.


2009/4/9 Cristian Peraferrer <co...@gmail.com>:
> So, is it possible to *really* develop internationalized struts web apps?
> How can I add chinese or japanese, if the way to internationalize it isn't
> capable to use other encoding than ASCII? I can't understand that.
>
> Any idea?
>
> Thanks,
> Cristian.
>
> On 09/04/2009, at 11:39, kindlerm@arcor.de wrote:
>
>> If you look in the Java docs, you will see this is not possible.
>> .properties files are always ASCII. The only possibility to include
>> non-ASCII characters is using the Unicode codes \uxxxx. I do hate this.
>>
>> There might be a way to extend the resource bundle framework to support
>> files using other encodings, but I never found a ready-to-use package and
>> writing it myself was never worthwhile.
>>
>> Martin
>>
>>
>> ----- Original Nachricht ----
>> Von:     Cristian Peraferrer <co...@gmail.com>
>> An:      user@struts.apache.org
>> Datum:   09.04.2009 11:28
>> Betreff: [s2] Using UTF-8 in .properties files
>>
>>> Hi,
>>>
>>> How I can use UTF-8 in the .properties files? (I need the .properties
>>> files for i18n, so loggically I will need characters other than the
>>> contained in ASCII or latin1).
>>>
>>> Thanks,
>>> Cristian.
>>>
>>> --
>>> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> --
> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Aw: [s2] Using UTF-8 in .properties files

Posted by Cristian Peraferrer <co...@gmail.com>.
So, is it possible to *really* develop internationalized struts web  
apps? How can I add chinese or japanese, if the way to  
internationalize it isn't capable to use other encoding than ASCII? I  
can't understand that.

Any idea?

Thanks,
Cristian.

On 09/04/2009, at 11:39, kindlerm@arcor.de wrote:

> If you look in the Java docs, you will see this is not  
> possible. .properties files are always ASCII. The only possibility  
> to include non-ASCII characters is using the Unicode codes \uxxxx. I  
> do hate this.
>
> There might be a way to extend the resource bundle framework to  
> support files using other encodings, but I never found a ready-to- 
> use package and writing it myself was never worthwhile.
>
> Martin
>
>
> ----- Original Nachricht ----
> Von:     Cristian Peraferrer <co...@gmail.com>
> An:      user@struts.apache.org
> Datum:   09.04.2009 11:28
> Betreff: [s2] Using UTF-8 in .properties files
>
>> Hi,
>>
>> How I can use UTF-8 in the .properties files? (I need the .properties
>> files for i18n, so loggically I will need characters other than the
>> contained in ASCII or latin1).
>>
>> Thanks,
>> Cristian.
>>
>> -- 
>> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

-- 
GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Aw: [s2] Using UTF-8 in .properties files

Posted by ki...@arcor.de.
If you look in the Java docs, you will see this is not possible. .properties files are always ASCII. The only possibility to include non-ASCII characters is using the Unicode codes \uxxxx. I do hate this.

There might be a way to extend the resource bundle framework to support files using other encodings, but I never found a ready-to-use package and writing it myself was never worthwhile.

Martin


----- Original Nachricht ----
Von:     Cristian Peraferrer <co...@gmail.com>
An:      user@struts.apache.org
Datum:   09.04.2009 11:28
Betreff: [s2] Using UTF-8 in .properties files

> Hi,
> 
> How I can use UTF-8 in the .properties files? (I need the .properties  
> files for i18n, so loggically I will need characters other than the  
> contained in ASCII or latin1).
> 
> Thanks,
> Cristian.
> 
> -- 
> GPG Key-ID: 0x564903FA - Jabber ID: corellian at swissjabber.ch
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org