You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Julia Yang <jy...@graviton.com> on 2001/12/12 02:11:26 UTC

Help, How to display chinese in jsp by using message tag ?

Hi, all
Can any one tell me how to use message tag to display Chinese in jsp

I have a property file called application_zh.properties which has
English at left and Chinese at right for each entry.  
Example: expression_input.ok= ¹«Ê½ 

In my jsp I use message tag to find the matched Chinese through English
text and try display the  it .
Example: <bean:message key="expression_input.ok"/>  

In my jsp, I set up the 
<head><META http-equiv="Content-Type" content="text/html;
charset=gb2312"></head> 

My problem is the application found the file but display nothing.

Thanks 

Julia

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Help, How to display chinese in jsp by using message tag ?

Posted by Chris Birch <ch...@artlas.net>.
Hi,

My guess is that the code being used to load the file off disk is decoding
the text using the wrong charset to decode.  In the UK, the JVM's default
charset is normally iso-8859-1 and this is used when loading any text files
from disk and converting them into double byte unicode (Java Strings).

In the javadoc for java.util.Properties, the following is found:

"When saving properties to a stream or loading them from a stream, the ISO
8859-1 character encoding is used. For characters that cannot be directly
represented in this encoding, Unicode escapes are used;"

I assume this applies applies to the struts resource implementation, it will
certainly apply to java.util.PropertyResourceBundle.

According to the docs, after running the jsdk tool 'native2ascii' to convert
your GB2312 text into unicode escaped ascii, things may work.  The docs seem
to indicate that property loading streams will convert the unicode escapes.

Hope this helps, regards,
Chris.

-----Original Message-----
From: Julia Yang [mailto:jyang@graviton.com]
Sent: 12 December 2001 01:11
To: struts-user@jakarta.apache.org
Subject: Help, How to display chinese in jsp by using message tag ?


Hi, all
Can any one tell me how to use message tag to display Chinese in jsp

I have a property file called application_zh.properties which has
English at left and Chinese at right for each entry.
Example: expression_input.ok= ¹«Ê½

In my jsp I use message tag to find the matched Chinese through English
text and try display the  it .
Example: <bean:message key="expression_input.ok"/>

In my jsp, I set up the
<head><META http-equiv="Content-Type" content="text/html;
charset=gb2312"></head>

My problem is the application found the file but display nothing.

Thanks

Julia

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>