carlo latasa
Wed, 24 Mar 2004 17:23:45 -0800
From: Jason Lea <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Re: i18n with Japanese characters and tags.... Date: Thu, 25 Mar 2004 09:39:40 +1200
He was saying it 'can' display Japanese characters. The example doesn't have any Japanese characters in in (if i remember correctly), but if they are put into the properties files for the locale they will be displayed.
You should look into that http://www.anassina.com/struts/i18n/i18n.html page as it explains a lot.
I think the main problem is you have the Japanese characters already converted into HTML in your application as yuo have them in the format ハ. When you use a bean to write it out, the bean tried to escape any characters that are significant to HTML, and the '&' character is one of them. That is why it replaces your '&' with '&'. The bean is trying to help by displaying the text you provided in HTML so that it will appear as ハ on the page. The 'filter=false' stops it doing this, but also means if you have some other characters like '<' in your text then they won't be escaped and could cause the page to be rendered incorrectly.
When I display Japanese characters on my pages I store them in Japanese in a .properties file, then use native2ascii to convert those japanese characters into the Java Unicode properties file format of \u####. When java reads them in, the actual unicode character is passed around in java and output directly into the html page. The page encoding is set to UTF-8, and the browser can display it correctly. The bean:write will also still escape the characters that need it such as '&' and '<'. This also means I am not dealing with HTML formatting inside my Java code, and can happily store the same characters in files, databases etc or output to another device instead of HTML.
-- Jason Lea
carlo latasa wrote:
>I just checked the example application and did not see anything on Japanese
>characters. I'm at:
>http://localhost:8080/struts-example/tour.do
>
>Did you mean that if I were to just take this code and modify it to display
>these characters? Or is the example somewhere else?
>
>
>
>
>>From: <[EMAIL PROTECTED]>
>>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>Subject: Re: i18n with Japanese characters and tags....
>>Date: Tue, 23 Mar 2004 16:12:20 +0900
>>
>>Carlo,
>>
>>Have you checked the example application included in Struts1.1(or
>>current CVS)? It can show Japanese characters correctly without any
>>special implementations.
>>I think it will be a help for your problem.
>>
>>The most frequent mistake in such case is lack of unicode escape
>>to their message resource files.
>>Don't forget "native2ascii" when you make your resource files.
>>
>>see also : http://www.anassina.com/struts/i18n/i18n.html
>>
>>----
>>Yoshinori Ashizawa
>>Ja-Jakarta Project www.jajakarta.org
>>
>>
>>carlo latasa" <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>>Hello,
>>>
>>>I'm trying to show Japanese characters on my jsp pages however the "&"
>>>character of the charset is coming back as & which is preventing the
>>>characters from being displayed correctly. They look like:
>>>キカスハ
>>>
>>>Note, the bean:write tag renders the characters correctly when the
>>>
>>>
>>filter
>>
>>
>>>attribute is set to "false".
>>>
>>>I've got a struts application using both Tomcat and Jrun and I've set my
>>>controller element of the struts-config.xml as:
>>>
>>><controller contentType="text/html; charset=JISAutoDetect"/>
>>>
>>>and at the top of a tiles.jsp that's at the head of every page I've got
>>>
>>>
>>a:
>>
>>
>>><%@ page contentType="html/text; charset=JISAutoDetect" %>
>>>
>>><head>
>>> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
>>>
>>>
>>charset=JISAutoDetect"
>>
>>
>>>%>
>>>
>>>..... to set the encoding.
>>>
>>>My hunch is that this is something that Struts is doing to the in the
>>>RequestProcessor or Controller.
>>>Could/should I write a Filter to override this issue?
>>>
>>>Is this something I chould set in a .css called in the tiles.jsp?
>>>
>>>Any help is much appreciated.
>>>
>>>
>>>Carlo Latasa -
>>>
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
>
>Carlo Latasa - Home: (510) 231-9655 Cell: (415) 385-1567
>
>_________________________________________________________________
>MSN Toolbar provides one-click access to Hotmail from any Web page ・FREE
>download! http://toolbar.msn.com/go/onm00200413ave/direct/01/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]