You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Gunnar Eketrapp <gu...@gmail.com> on 2009/10/21 09:56:15 UTC

UTF-8 vs ISO-8859

Hi !

What is the recommended encoding for text files within a T5 project.

When I started the move to T5 i decided upon UTF-8 for all my text (*.java,
*.tml, *.properties, *.xml)  files but perhaps that was not too smart when
it comes to java property files.

I just read  ...

    Properties files are ISO-8859-1 by definition - see the docs for the
Properties <http://java.sun.com/javase/6/docs/api/java/util/Properties.html>class.


How do you folks do?

Note: The issues I have is that eclipse keeps insisting that my .properties
files are ISO-8859 and I have to manually switch encoding
for each new property file i create or copy. Besides that's everyting works
fine ....


Thanks in advance!
Gunnar Eketrapp

Re: UTF-8 vs ISO-8859

Posted by Martin Strand <do...@gmail.com>.
ISO-8859 is only the default for java.util.Properties, not for Tapestry.
http://java.sun.com/javase/6/docs/api/java/util/Properties.html#load(java.io.InputStream)

You can configure Eclipse to use UTF-8 for *.properties if you go to Preferences --> General --> Content Types
That way you don't have to change it for each file.

On Wed, 21 Oct 2009 09:56:15 +0200, Gunnar Eketrapp <gu...@gmail.com> wrote:

> Hi !
>
> What is the recommended encoding for text files within a T5 project.
>
> When I started the move to T5 i decided upon UTF-8 for all my text (*.java,
> *.tml, *.properties, *.xml)  files but perhaps that was not too smart when
> it comes to java property files.
>
> I just read  ...
>
>     Properties files are ISO-8859-1 by definition - see the docs for the
> Properties <http://java.sun.com/javase/6/docs/api/java/util/Properties.html>class.
>
>
> How do you folks do?
>
> Note: The issues I have is that eclipse keeps insisting that my .properties
> files are ISO-8859 and I have to manually switch encoding
> for each new property file i create or copy. Besides that's everyting works
> fine ....
>
>
> Thanks in advance!
> Gunnar Eketrapp

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: UTF-8 vs ISO-8859

Posted by Olle Hallin <ol...@hit.se>.
We always use UTF-8.
We usually add a mandatory comment that contains non-ASCII characters at the
top of the file, and a unit test that verifies it. It's too common that some
developer screws up the file by opening it with wrong encoding.

Example:

*.properties:
----------------
# DO NOT REMOVE: räksmörgås

PropertiesEncodingTest.java
------------------------------------
foreach *.properties:
   assertFirstLineEquals("# DO NOT REMOVE: räksmörgås")

This has save our ass many times :)

Olle Hallin
Senior Java Developer and Architect
olle.hallin@crisp.se
www.crisp.se




2009/10/21 Ulrich Stärk <ul...@spielviel.de>

>
>
> Am 21.10.2009 10:02 schrieb Stephan Windmüller:
>
>  Note: The issues I have is that eclipse keeps insisting that my
>>> .properties
>>> files are ISO-8859 and I have to manually switch encoding
>>> for each new property file i create or copy. Besides that's everyting
>>> works
>>> fine ....
>>>
>>
> Forgot to mention: You can change the default encoding for a file type in
> Eclipse. Under Preferences  go to General -> Content Types, expand Text and
> choose Java properties file. At the bottom of the form you can now input
> your desired default encoding
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: UTF-8 vs ISO-8859

Posted by Ulrich Stärk <ul...@spielviel.de>.

Am 21.10.2009 10:02 schrieb Stephan Windmüller:

>> Note: The issues I have is that eclipse keeps insisting that my .properties
>> files are ISO-8859 and I have to manually switch encoding
>> for each new property file i create or copy. Besides that's everyting works
>> fine ....

Forgot to mention: You can change the default encoding for a file type in Eclipse. Under Preferences 
  go to General -> Content Types, expand Text and choose Java properties file. At the bottom of the 
form you can now input your desired default encoding


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: UTF-8 vs ISO-8859

Posted by Gunnar Eketrapp <gu...@gmail.com>.
Ok and thanks  for the answer!  (I read the text on Stackoverflow btw ...)
I will continue with utf-8 for prop files.


2009/10/21 Stephan Windmüller <st...@cs.tu-dortmund.de>

> Gunnar Eketrapp wrote:
>
> > What is the recommended encoding for text files within a T5 project.
>
> UTF-8
>
> > I just read  ...
> >
> >     Properties files are ISO-8859-1 by definition - see the docs for the
> > Properties <
> http://java.sun.com/javase/6/docs/api/java/util/Properties.html>class.
>
> Where do you read that? This is from the tapestry home page:
>
> "Tapestry uses the UTF-8 charset when reading the properties files in a
> message catalog."
>
> http://tapestry.apache.org/tapestry5/guide/localization.html
>
> > How do you folks do?
>
> Using UTF-8 for the property files.
>
> > Note: The issues I have is that eclipse keeps insisting that my
> .properties
> > files are ISO-8859 and I have to manually switch encoding
> > for each new property file i create or copy. Besides that's everyting
> works
> > fine ....
>
> Same here. It is a bit annoying, but it works.
>
> HTH
>  Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo

Re: UTF-8 vs ISO-8859

Posted by Martin Strand <do...@gmail.com>.
Also, JDK 6 added another load() method, so you can use properties.load(new InputStreamReader(in, utf8)) to load utf8 files.

On Wed, 21 Oct 2009 10:35:22 +0200, Ulrich Stärk <ul...@spielviel.de> wrote:

> A bit of explanation:
>
> Normally, property files are expected to be ISO-8559-1 encoded [1]. When there are characters that
> can't be represented using that character encoding, unicode escapes must be used. The native2ascii
> tool can convert property files from UTF-8 to ISO-8859-1.
> Tapestry does the same reencoding transparently, i.e. it treats all property files as UTF-8 encoded
> and automaticalle converts them to ISO-8850-1 with unicode escapes.
>
> Uli
>
> [1] http://java.sun.com/javase/6/docs/api/java/util/Properties.html
>
> Am 21.10.2009 10:02 schrieb Stephan Windmüller:
>> Gunnar Eketrapp wrote:
>>
>>> What is the recommended encoding for text files within a T5 project.
>>
>> UTF-8
>>
>>> I just read  ...
>>>
>>>     Properties files are ISO-8859-1 by definition - see the docs for the
>>> Properties <http://java.sun.com/javase/6/docs/api/java/util/Properties.html>class.
>>
>> Where do you read that? This is from the tapestry home page:
>>
>> "Tapestry uses the UTF-8 charset when reading the properties files in a
>> message catalog."
>>
>> http://tapestry.apache.org/tapestry5/guide/localization.html
>>
>>> How do you folks do?
>>
>> Using UTF-8 for the property files.
>>
>>> Note: The issues I have is that eclipse keeps insisting that my .properties
>>> files are ISO-8859 and I have to manually switch encoding
>>> for each new property file i create or copy. Besides that's everyting works
>>> fine ....
>>
>> Same here. It is a bit annoying, but it works.
>>
>> HTH
>>  Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: UTF-8 vs ISO-8859

Posted by Ulrich Stärk <ul...@spielviel.de>.
A bit of explanation:

Normally, property files are expected to be ISO-8559-1 encoded [1]. When there are characters that 
can't be represented using that character encoding, unicode escapes must be used. The native2ascii 
tool can convert property files from UTF-8 to ISO-8859-1.
Tapestry does the same reencoding transparently, i.e. it treats all property files as UTF-8 encoded 
and automaticalle converts them to ISO-8850-1 with unicode escapes.

Uli

[1] http://java.sun.com/javase/6/docs/api/java/util/Properties.html

Am 21.10.2009 10:02 schrieb Stephan Windmüller:
> Gunnar Eketrapp wrote:
> 
>> What is the recommended encoding for text files within a T5 project.
> 
> UTF-8
> 
>> I just read  ...
>>
>>     Properties files are ISO-8859-1 by definition - see the docs for the
>> Properties <http://java.sun.com/javase/6/docs/api/java/util/Properties.html>class.
> 
> Where do you read that? This is from the tapestry home page:
> 
> "Tapestry uses the UTF-8 charset when reading the properties files in a
> message catalog."
> 
> http://tapestry.apache.org/tapestry5/guide/localization.html
> 
>> How do you folks do?
> 
> Using UTF-8 for the property files.
> 
>> Note: The issues I have is that eclipse keeps insisting that my .properties
>> files are ISO-8859 and I have to manually switch encoding
>> for each new property file i create or copy. Besides that's everyting works
>> fine ....
> 
> Same here. It is a bit annoying, but it works.
> 
> HTH
>  Stephan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: UTF-8 vs ISO-8859

Posted by Joakim Olsson <ar...@lingonpaj.com>.
On Wed, 2009-10-21 at 10:02 +0200, Stephan Windmüller wrote:
> Gunnar Eketrapp wrote:
> 

> > Note: The issues I have is that eclipse keeps insisting that my .properties
> > files are ISO-8859 and I have to manually switch encoding
> > for each new property file i create or copy. Besides that's everyting works
> > fine ....
> 
> Same here. It is a bit annoying, but it works.
> 

It's possible to get Eclipse to use UTF-8 as default.

Go to Window - Preferences - General - Content types.

Expand Text and then click on Java Properties File. You now have a field
for Default encoding at the bottom.

Regards,
Joakim



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: UTF-8 vs ISO-8859

Posted by Stephan Windmüller <st...@cs.tu-dortmund.de>.
Gunnar Eketrapp wrote:

> What is the recommended encoding for text files within a T5 project.

UTF-8

> I just read  ...
> 
>     Properties files are ISO-8859-1 by definition - see the docs for the
> Properties <http://java.sun.com/javase/6/docs/api/java/util/Properties.html>class.

Where do you read that? This is from the tapestry home page:

"Tapestry uses the UTF-8 charset when reading the properties files in a
message catalog."

http://tapestry.apache.org/tapestry5/guide/localization.html

> How do you folks do?

Using UTF-8 for the property files.

> Note: The issues I have is that eclipse keeps insisting that my .properties
> files are ISO-8859 and I have to manually switch encoding
> for each new property file i create or copy. Besides that's everyting works
> fine ....

Same here. It is a bit annoying, but it works.

HTH
 Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org