Does tapestry5 don't support
jdk1.4?!
离人网
From: "xu yiwei" <[EMAIL PROTECTED]>
Reply-To: "Tapestry users" <users@tapestry.apache.org>
To: "Tapestry users" <users@tapestry.apache.org>
Subject: Re: Does T5.0.3 support chinese??
Date: Sun, 15 Apr 2007 21:05:54 +0800
>I wrote a *.properties using the UTF-8 encoding;
>then i use the ${message:*} to display the chinese,
>
>but i still couldn't write chinese in the *.html file, or got a
>wrong encoding.
>so can I change t5 to read a *.html with a UTF-8 encoding???How?
>
>
>在 07-4-14,xu yiwei<[EMAIL PROTECTED]> 写道:
>>in the AppModule.java,my code:
>>/*
>> * utf-8 encoding
>> *
>> */
>> public HttpServletRequestFilter buildEncodingFilter(final
>>Log log){
>> return new HttpServletRequestFilter(){
>> public boolean service( HttpServletRequest request,
>> HttpServletResponse response,
>> HttpServletRequestHandler handler)
>> throws IOException{
>>
>> try{
>>
>>
>> request.setCharacterEncoding("UTF-8");
>> response.setContentType("text/html;
>>charset=UTF-8");
>> return handler.service(request, response);
>> }
>> finally{
>>
>> }
>>
>> }
>> };
>>/*contributing a HttpServletRequestFilter */
>> public void contributeHttpRequestsFilter(
>>
>>OrderedConfiguration<HttpServletRequestFilter> configuration,
>> @InjectService("EncodingFilter")
>> HttpServletRequestFilter filter) {
>> configuration.add("Encoding", filter);
>> }
>>
>>
>>doesn't work!
>>Maybe something wrong!
>>Can anyone tell me a complete solution?
>>
>>
>>
>>
>>
>>
>>
>>
>>2007/4/13, DigitLiao <[EMAIL PROTECTED]>:
>> > I added a Filter, and it did succeed.
>> >
>> > public void doFilter(ServletRequest arg0, ServletResponse arg1,
>> > FilterChain arg2) throws IOException,
>>ServletException {
>> > // TODO Auto-generated method stub
>> > arg1.setCharacterEncoding("UTF-8");
>> > arg1.setContentType("text/html; charset=UTF-8");
>> >
>> > arg2.doFilter(arg0, arg1);
>> > }
>> >
>> >
>> > <?xml version="1.0" encoding="UTF-8" ?>
>> >
>> > <html
>>xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>> > <head>
>> > <title>hilo Start Page</title>
>> > <meta http-equiv="Content-Type" content="text/html;
>>charset=UTF-8" />
>> >
>> > </head>
>> > <body>
>> > <p></p>
>> > <p>
>> > oooooooooooooo<br />
>> >
>> > <t:DigitComponent>
>> > TT
>> > </t:DigitComponent>
>> > zzz
>> > </p>
>> > 中文�y ��
>> > <p> Choose a number from 1 to 10: </p>
>> > <p>
>> > <t:loop source="1..10" value="index">
>> > <a t:id="select" t:type="actionLink"
>>t:context="index">${index}</a>
>> > </t:loop>
>> > </p>
>> > </body>
>> > </html>
>> >
>> > On 4/13/07, xu yiwei <[EMAIL PROTECTED]> wrote:
>> > >
>> > > The question is the UTF-8 couldn't work!
>> > > putting a UTF-8 char in the Start.html will result in a
>>exception.
>> > > the "Start.html" is ISO-8859-1 charset default, can I change
>>that? and
>> > > How?
>> > >
>> > >
>> > >
>> > > 2007/4/13, Kevin Lau <[EMAIL PROTECTED]>:
>> > > > Well, your question now is not about whether the T5 support
>>Chinese,
>> > > it's
>> > > > about how to use i18n. You don't even know why you put the
>>"charset=GBK"
>> > > > into the template or what's the difference between UTF-8 and
>>GBK.
>> > > >
>> > > > My suggestion is, forget about the Chinese first, use UTF8
>>to get the
>> > > i18n
>> > > > work, then think about the Chinese thing.
>> > > >
>> > > > On 4/13/07, xu yiwei <[EMAIL PROTECTED]> wrote:
>> > > > >
>> > > > > <meta http-equiv="Content-Type" content="text/html;
>>charset=GBK">
>> > > > > doesn't work right,
>> > > > > Exception message:
>> > > > > Failure parsing template context:WEB-INF/Start.html: The
>>element type
>> > > > > "meta" must be terminated by the matching end-tag
>>"</meta>".
>> > > > >
>> > > > > so I put "</meta>" after the "<meta
>>http-equiv="Content-Type"
>> > > > > content="text/html; charset=GBK"> </meta>"
>> > > > >
>> > > > > Start.html include "The current time is:
>>${currentTime}.时间 "
>> > > > > 时间 means time!
>> > > > > Exception message:
>> > > > > Failure parsing template context:WEB-INF/Start.html:
>>Invalid byte 1 of
>> > > > > 1-byte UTF-8 sequence.
>> > > > > The current time is: ${currentTime}.??
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > 2007/4/13, Kevin Lau <[EMAIL PROTECTED]>:
>> > > > > > <?xml version="1.0" encoding="UTF-8"?> is for xml file,
>>not for the
>> > > html
>> > > > > > file.
>> > > > > > For the html file, you need to specify the charset by
>>such staff
>> > > > > > <meta http-equiv="Content-Type" content="text/html;
>>charset=GBK">
>> > > > > >
>> > > > > > You really need to learn about the basic before
>>purposeless test...
>> > > > > >
>> > > > > > On 4/13/07, xu yiwei <[EMAIL PROTECTED]> wrote:
>> > > > > > >
>> > > > > > > I wtite "<?xml version="1.0" encoding="UTF-8"?>" at
>>the first
>> > > line of
>> > > > > > > Start.html.
>> > > > > > > "<p>现在时间是: ${currentTime}.</p>" same as "<p>The
>>current time is:
>> > > > > > > ${currentTime}. </p>"
>> > > > > > > Something's wrong!
>> > > > > > > The exception message:
>> > > > > > > Failure parsing template context:WEB-INF/Start.html:
>>Invalid byte
>> > > 2 of
>> > > > > > > 2-byte UTF-8 sequence.
>> > > > > > > "?????: ${currentTime}."
>> > > > > > >
>> > > > > > > It couldn't read " a file with the correct charset "
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > 2007/4/13, Howard Lewis Ship <[EMAIL PROTECTED]>:
>> > > > > > > > T5 does not yet have the logic in place in T4 to
>>allow the
>> > > character
>> > > > > > > > set to be configured before reading a .properties
>>file or HTML
>> > > > > > > > template. For the template, you should be able to
>>set the
>> > > charset
>> > > > > > > > inside the <?xml?> tag.
>> > > > > > > >
>> > > > > > > > The other aspect is output; T5 is hard coded to
>>send, if I
>> > > remember
>> > > > > > > > correctly, UTF-8, which will be hard pressed to
>>output Chinese
>> > > > > > > > properly. So there's problems at both ends: reading
>>a file with
>> > > the
>> > > > > > > > correct charset, resulting in correct Unicode in
>>memory, then
>> > > > > > > > outputting that unicode into the correct charset for
>>the
>> > > browser.
>> > > > > > > >
>> > > > > > > > On 4/12/07, xu yiwei <[EMAIL PROTECTED]> wrote:
>> > > > > > > > > *_zh.html could not display chinese!
>> > > > > > > > > Doesn't work!
>> > > > > > > > >
>> > > > > > > > > 2007/4/12, Kevin Lau <[EMAIL PROTECTED]>:
>> > > > > > > > > > Use the localization.
>> > > > > > > > > >
>> > > > > > >
>> > > > >
>> > >
>>http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html
>> > > > > > > > > >
>> > > > > > > > > > On 4/12/07, xu yiwei <[EMAIL PROTECTED]>
>>wrote:
>> > > > > > > > > > >
>> > > > > > > > > > > I am now trying to use T5 to develop a
>>simple system.
>> > > > > > > > > > > but it couldn't display the chinese.
>> > > > > > > > > > > This method did not work
>> > > > > > > > > > >
>>configuration.add("tapestry.supported-locales", "zh");
>> > > > > > > > > > > i couldn't write non-ascll chars in the
>>page(Start.html
>> > > );
>> > > > > > > > > > >
>> > > > > > > > > > >
>> will
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > >
>> > >
>>---------------------------------------------------------------------
>> > > > > > > > > > > To unsubscribe, e-mail:
>> > > [EMAIL PROTECTED]
>> > > > > > > > > > > For additional commands, e-mail:
>> > > > > [EMAIL PROTECTED]
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > > --
>> > > > > > > > > >
>> > > > > > >
>> > >
>>.....................................................................
>> > > > > > > > > > Man in the mirror
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > --
>> > > > > > > > > Chinese name:徐 依伟
>> > > > > > > > > English name: will
>> > > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > --
>> > > > > > > > Howard M. Lewis Ship
>> > > > > > > > TWD Consulting, Inc.
>> > > > > > > > Independent J2EE / Open-Source Java Consultant
>> > > > > > > > Creator and PMC Chair, Apache Tapestry
>> > > > > > > > Creator, Apache HiveMind
>> > > > > > > >
>> > > > > > > > Professional Tapestry training, mentoring, support
>> > > > > > > > and project work. http://howardlewisship.com
>> > > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > --
>> > > > > > > Chinese name:徐 依伟
>> > > > > > > English name: will
>> > > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > >
>> > >
>>.....................................................................
>> > > > > > Man in the mirror
>> > > > > >
>> > > > >
>> > > > >
>> > > > > --
>> > > > > Chinese name:徐 依伟
>> > > > > English name: will
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > >
>>.....................................................................
>> > > > Man in the mirror
>> > > >
>> > >
>> > >
>> > > --
>> > > Chinese name:徐 依伟
>> > > English name: will
>> > >
>> >
>>
>>
>>--
>>Chinese name:徐 依伟
>>English name: will
>>
>
>
>--
>Chinese name:徐 依伟
>English name: will
使 用 MSN Messenger 与联机的朋友进行交流 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]