You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Numa Schmeder <nu...@euroconsumers.com> on 2006/05/06 12:49:20 UTC

messages-encoding problem for japanese in utf-8?

Hello,
Thanks for your help, here is my problem:
I have a problem localizing a tapestry application in japanese, a  
translator has translated all properties file in japanese in utf-8,  
so all the properties file are encoded in utf-8, opening thoses file  
in eclipse or in a text editor that support utf-8 works great i can  
see all japanese characters correctly.  Then i set as specified in  
the docs the property '    <property  
name="org.apache.tapestry.template-encoding_ja" value="UTF-8"/>  ' in  
my .application.
When i display a page in japanese i get cabalistic characters on my  
web page like: 'Æ—…Á®Ã‚¨Ã‚ à 
‚¹ÃƑ‘ÃƑ¼ÃƑˆ' , but characters coming from the postgres  
database display fines, the database is encoded in utf-8.
The output of my web pages for the tapestry application is in UTF-8  
which is specified by default.
I have tried to set the property '	<property  
name="org.apache.tapestry.messages-encoding" value="UTF-8"/>' in my  
component or page specification but this still doesn't work i get the  
same cabalistic characters.
I don't know if i have to do the same as for ResourcesBundle  
properties file and convert them using native2ascii or do i have to  
specify another encoding and encode my file in another character set?
I use tapestry 3 and here is snapshot of my .application:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
   "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
   "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<!-- generated by Spindle, http://spindle.sourceforge.net -->

<application name="Ec-voyage" engine- 
class="com.ec.web.voyage.tapestry.ECVoyageEngine">

     <description>Le-Voyage website</description>
     <property name="org.apache.tapestry.template-encoding_ja"  
value="UTF-8"/>
	<property name="org.apache.tapestry.messages-encoding_ja"  
value="UTF-8"/>
	<property name="org.apache.tapestry.visit-class"  
value="com.ec.web.voyage.tapestry.Visit"/>
     <page name="Home" specification-path="Home.page"/>
     <library id="contrib" specification-path="/org/apache/tapestry/ 
contrib/Contrib.library"/>
     <library id="ec" specification-path="/com/ec/web/common/tapestry/ 
components/EcComponents.library"/>
     <library id="base" specification-path="/org/mb/tapestry/base/ 
base.library"/>
     <library id="checkboxes" specification-path="/org/mb/tapestry/ 
checkboxes/checkboxes.library"/>
     <library id="ws" specification-path="/myws/tapestry/components/ 
MyWorkspace.library"/>

</application>


If any one knows please give me a hint?

Thank you so much!

Kind Regards

Numa


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


Re: messages-encoding problem for japanese in utf-8?

Posted by Sam Gendler <sg...@ideasculptor.com>.
Your java virtual machine is probably not using UTF-8 as the default
charset.  This is a common problem that isn't anywhere in any
documentation (at Tapestry, Sun, or just about anywhere else).  You
can only change the default charset of your JVM before it runs.  At
run time, your only choice is to explicitly set the charset for each
input and output reader/writer, which you can't do to the Tapestry
code.  To fix it, you must set the system property file.encoding to
UTF-8.  For tomcat users, you can do that by defining a variable
called JAVA_OPTS in your shell and setting the value to
"-Dfile.encoding=UTF-8"

You can determine the default charset that is set up by your OS with
the following code:

import java.nio.charset.Charset;
public class charset {
    public static void main(String[] args) {
        System.out.println(Charset.defaultCharset().displayName());
    }
}

On 5/6/06, Numa Schmeder <nu...@euroconsumers.com> wrote:
> Hello,
> Thanks for your help, here is my problem:
> I have a problem localizing a tapestry application in japanese, a
> translator has translated all properties file in japanese in utf-8,
> so all the properties file are encoded in utf-8, opening thoses file
> in eclipse or in a text editor that support utf-8 works great i can
> see all japanese characters correctly.  Then i set as specified in
> the docs the property '    <property
> name="org.apache.tapestry.template-encoding_ja" value="UTF-8"/>  ' in
> my .application.
> When i display a page in japanese i get cabalistic characters on my
> web page like: 'Æ—…Á(r)¨Â Ã
> ‚¹ÃƑ'ÃƑ¼ÃƑˆ' , but characters coming from the postgres
> database display fines, the database is encoded in utf-8.
> The output of my web pages for the tapestry application is in UTF-8
> which is specified by default.
> I have tried to set the property '      <property
> name="org.apache.tapestry.messages-encoding" value="UTF-8"/>' in my
> component or page specification but this still doesn't work i get the
> same cabalistic characters.
> I don't know if i have to do the same as for ResourcesBundle
> properties file and convert them using native2ascii or do i have to
> specify another encoding and encode my file in another character set?
> I use tapestry 3 and here is snapshot of my .application:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE application PUBLIC
>    "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> <!-- generated by Spindle, http://spindle.sourceforge.net -->
>
> <application name="Ec-voyage" engine-
> class="com.ec.web.voyage.tapestry.ECVoyageEngine">
>
>      <description>Le-Voyage website</description>
>      <property name="org.apache.tapestry.template-encoding_ja"
> value="UTF-8"/>
>         <property name="org.apache.tapestry.messages-encoding_ja"
> value="UTF-8"/>
>         <property name="org.apache.tapestry.visit-class"
> value="com.ec.web.voyage.tapestry.Visit"/>
>      <page name="Home" specification-path="Home.page"/>
>      <library id="contrib" specification-path="/org/apache/tapestry/
> contrib/Contrib.library"/>
>      <library id="ec" specification-path="/com/ec/web/common/tapestry/
> components/EcComponents.library"/>
>      <library id="base" specification-path="/org/mb/tapestry/base/
> base.library"/>
>      <library id="checkboxes" specification-path="/org/mb/tapestry/
> checkboxes/checkboxes.library"/>
>      <library id="ws" specification-path="/myws/tapestry/components/
> MyWorkspace.library"/>
>
> </application>
>
>
> If any one knows please give me a hint?
>
> Thank you so much!
>
> Kind Regards
>
> Numa
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: messages-encoding problem for japanese in utf-8?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Numa Schmeder <numa <at> euroconsumers.com> writes:

> I have a problem localizing a tapestry application in japanese, a  
> translator has translated all properties file in japanese in utf-8,  
> so all the properties file are encoded in utf-8, opening thoses file  
> in eclipse or in a text editor that support utf-8 works great i can  
> see all japanese characters correctly.  Then i set as specified in  
> the docs the property '    <property  
> name="org.apache.tapestry.template-encoding_ja" value="UTF-8"/>  ' in  
> my .application.
> When i display a page in japanese i get cabalistic characters on my  
> web page like:

Open your .html file in a browser and check what character set it is in.
For example, in FireFox, choose View | Character Encoding to see which
one is selected. I suspect your file is not in UTF-8.

--
Kent Tong
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)


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


Re: messages-encoding problem for japanese in utf-8?

Posted by Numa Schmeder <nu...@nsconsult.net>.
Thanks a lot for your answer, it helped me.

Here is my confusion:

-  For T3 you cannot set messages encoding.  Messages are java  
properties that must be only in SO 8859-1 and therefor you must use a  
tool like native2ascii to convert japanese text or the excellent  
propedit
- For T4 you can set messages encoding and write your messages in  
plain utf-8 no need for native2ascii

Thanks

Numa
Le 7 mai 06 à 03:17, Nick Westgate a écrit :

> Hi Numa.
>
>> I have tried to set the property '	<property
>> name="org.apache.tapestry.messages-encoding" value="UTF-8"/>' in my
>> component or page specification but this still doesn't work i get the
>> same cabalistic characters.
>
> I'm using T3 for Japanese, and don't set "messages-encoding".
>
>> I don't know if i have to do the same as for ResourcesBundle
>> properties file and convert them using native2ascii or do i have to
>> specify another encoding and encode my file in another character set?
>> I use tapestry 3 and here is snapshot of my .application:
>
> Java properties files should be only ISO 8859-1 encoded, so yes,  
> you just need
> to use native2ascii or similar. I use the following Eclipse plugin  
> to edit my
> Japanese property files - it's much easier:
>
> http://propedit.sourceforge.jp/index_en.html
>
> Cheers,
> Nick.
>
>
> ---------------------------------------------------------------------
> 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: messages-encoding problem for japanese in utf-8?

Posted by Nick Westgate <ni...@jellyfish.co.nz>.
Hi Numa.

> I have tried to set the property '	<property  
> name="org.apache.tapestry.messages-encoding" value="UTF-8"/>' in my  
> component or page specification but this still doesn't work i get the  
> same cabalistic characters.

I'm using T3 for Japanese, and don't set "messages-encoding".

> I don't know if i have to do the same as for ResourcesBundle  
> properties file and convert them using native2ascii or do i have to  
> specify another encoding and encode my file in another character set?
> I use tapestry 3 and here is snapshot of my .application:

Java properties files should be only ISO 8859-1 encoded, so yes, you just need
to use native2ascii or similar. I use the following Eclipse plugin to edit my
Japanese property files - it's much easier:

http://propedit.sourceforge.jp/index_en.html

Cheers,
Nick.


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