You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Billy Ng <bi...@gmail.com> on 2007/10/16 22:27:59 UTC

UTF-8 Properties File

Hi folks,

Besides using native2ascii, would someone please recommend me how to make tocmat to work with UTF-8 properties files, thanks!

Billy Ng

Re: UTF-8 Properties File

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Billy,

(Note that this isn't a Tomcat problem; it's a Java problem.)

Billy Ng wrote:
> Don't know why?  It happens to me.  If you google "native2ascii BOM",
> you will see what other people were complaining.

They are complaining that native2ascii is not removing the BOM mark from
their input files, not that the BOM is being added to the output files.

UTF-8-encoded files do not need a BOM, but it is not strictly
prohibited. In your case, you already have a BOM in your UTF-8 file.

While it's regrettable that Sun won't fix the bug (actually, they have,
and then they un-fixed it because it broke older code), you ought to be
able to work around it.

There are so many workarounds, I'm not sure where to start. Here are the
ones I can immediately think of, in increasing-PITA-order:

- - Use UTF-16 as your source encoding instead of UTF-8.

- - Add a comment or blank line at the top of your properties files.
  All my props files have a comment and CVS info at the top, which
  is why I've never noticed.

- - Do you use native2ascii in your deployment, or do you hand-transcode
  these files when necessary? I ask because it would be pretty easy to
  chop-off the BOM from the file before running it through native2ascii
  if you were doing it as part of an automated deployment.

- - Another strategy would be to write your own native2ascii, which
  shouldn't be too difficult to do; write it with the BOM-sensitivity in
  mind. You could even replace native2ascii on your system.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHFpQ+9CaO5/Lv0PARAl7cAJ9mL2WEIzw3z/Z7OewZEDjGfqrZ8wCeL5Ih
J9E2eGX/laAtic3ZuI56kE4=
=8ZdG
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UTF-8 Properties File

Posted by Billy Ng <bi...@gmail.com>.
Don't know why????  It happens to me.  If you google "native2ascii BOM", you 
will see what other people were complaining.

Billy Ng

----- Original Message ----- 
From: "Christopher Schultz" <ch...@christopherschultz.net>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, October 17, 2007 1:26 PM
Subject: Re: UTF-8 Properties File


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Billy,
>
> Billy Ng wrote:
>> This is the major problem for the people to localize context.  \uxxxx
>> unicode format is not readable to them.
>
> That's why most people use native2ascii as part of their deployment
> procedure, and don't bother developers with that kind of detail.
>
>> The native2ascii will add the BOM to the beginning to fail 
>> ResourceBundle.
>
> It will? ISO-8859-1 shouldn't have a BOM. How are you running 
> native2ascii?
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHFm/Y9CaO5/Lv0PARAnjBAKCx260jasjJgS3mPCNRtMQVkljRiQCdHZlv
> C5TFQ1zOqRwjLeJUoozen+4=
> =XEC8
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UTF-8 Properties File

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Billy,

Billy Ng wrote:
> This is the major problem for the people to localize context.  \uxxxx
> unicode format is not readable to them.

That's why most people use native2ascii as part of their deployment
procedure, and don't bother developers with that kind of detail.

> The native2ascii will add the BOM to the beginning to fail ResourceBundle.

It will? ISO-8859-1 shouldn't have a BOM. How are you running native2ascii?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHFm/Y9CaO5/Lv0PARAnjBAKCx260jasjJgS3mPCNRtMQVkljRiQCdHZlv
C5TFQ1zOqRwjLeJUoozen+4=
=XEC8
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UTF-8 Properties File

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

Konstantin Kolinko wrote:
> You may try some tools to edit those files.

I am a native English speaker, and we use Attesoro
(http://attesoro.org/) to create localized properties files. It allows
you to use natural text, but saves to ISO-8859-1 transparently. It also
shows you which keys do/do not have values, which makes additional keys
(that is, keys added due to a new feature, etc.) much easier to manage.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHFora9CaO5/Lv0PARAnokAKCrUJxu2cLEKR0juRAmMZZPZByvoACfeNJk
9DoyvSn7GEUUSwf52ouweLk=
=kLTs
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UTF-8 Properties File

Posted by Konstantin Kolinko <kn...@gmail.com>.
You may try some tools to edit those files.

E.g., I am using this one as a plugin for Eclipse, but it may run separately:
http://propedit.sourceforge.jp/index_en.html


2007/10/17, Billy Ng <bi...@gmail.com>:
> This is the major problem for the people to localize context.  \uxxxx
> unicode format is not readable to them.
>
> The native2ascii will add the BOM to the beginning to fail ResourceBundle.
>
> Billy Ng
>
> ----- Original Message -----
> From: "Tim Funk" <fu...@joedog.org>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Wednesday, October 17, 2007 3:40 AM
> Subject: Re: UTF-8 Properties File
>
>
> > There is no such thing as UTF-8 properties files. Tomcat follows the same
> > rules as java when reading properties files.
> >
> > Properties file must be ISO8859-1 and if you have characters outside of
> > that character set - then you use native2ascii to encode those other
> > characters.
> >
> > -Tim
> >
> > Billy Ng wrote:
> >> Hi folks,
> >>
> >> Besides using native2ascii, would someone please recommend me how to make
> >> tocmat to work with UTF-8 properties files, thanks!
> >>
> >> Billy Ng
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UTF-8 Properties File

Posted by Billy Ng <bi...@gmail.com>.
This is the major problem for the people to localize context.  \uxxxx 
unicode format is not readable to them.

The native2ascii will add the BOM to the beginning to fail ResourceBundle.

Billy Ng

----- Original Message ----- 
From: "Tim Funk" <fu...@joedog.org>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, October 17, 2007 3:40 AM
Subject: Re: UTF-8 Properties File


> There is no such thing as UTF-8 properties files. Tomcat follows the same 
> rules as java when reading properties files.
>
> Properties file must be ISO8859-1 and if you have characters outside of 
> that character set - then you use native2ascii to encode those other 
> characters.
>
> -Tim
>
> Billy Ng wrote:
>> Hi folks,
>>
>> Besides using native2ascii, would someone please recommend me how to make 
>> tocmat to work with UTF-8 properties files, thanks!
>>
>> Billy Ng
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: UTF-8 Properties File

Posted by Tim Funk <fu...@joedog.org>.
There is no such thing as UTF-8 properties files. Tomcat follows the 
same rules as java when reading properties files.

Properties file must be ISO8859-1 and if you have characters outside of 
that character set - then you use native2ascii to encode those other 
characters.

-Tim

Billy Ng wrote:
> Hi folks,
> 
> Besides using native2ascii, would someone please recommend me how to make tocmat to work with UTF-8 properties files, thanks!
> 
> Billy Ng


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org