You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Korben Zhang <ko...@gmail.com> on 2008/01/03 16:33:20 UTC

Re: T5.0.7 still can't resolve encoding.

Charset puzzled me too.
I add Chinese resources file.
But cannot show properly.

I have tried:
1.add org.springframework.web.filter.CharacterEncodingFilter, doesn't work;

2.native2ascii resource files, doesn't work;

3.add
       configuration.add("tapestry.supported-locales", "en,zh");

doesn't work;

4.
   public static PageResponseRenderer decoratePageResponseRenderer(
            @InjectService("PageMarkupRenderer")
            final PageMarkupRenderer markupRenderer,
            @InjectService("MarkupWriterFactory")
            final MarkupWriterFactory markupWriterFactory, final Object
delegate)
        {

            return new PageResponseRenderer()
            {
                public void renderPageResponse(Page page, Response response)
throws IOException
                {
                    MarkupWriter writer =
markupWriterFactory.newMarkupWriter();
                    markupRenderer.renderPageMarkup(page, writer);
                    PrintWriter pw = response.getPrintWriter("text/html;
charset=UTF-8");
                    writer.toMarkup(pw);
                    pw.flush();
                }
            };
        }

doesn't work;

Is there a proposal method?




On Dec 30, 2007 9:56 PM, yuan gogo <go...@gmail.com> wrote:

> Thanks for answering.
>
> But I DID add this into my AppModule,  but the problem is still there.
> I finanlly solved this by using Spring charset encoding filter.
>
>
>
> 2007/12/29, Michael Lake <ml...@netvue.com>:
> >
> >
> > I'm also having this issue and i'm not even chinese.I did find this
> > though:
> >
> > http://wiki.apache.org/tapestry/Tapestry5Utf8Encoding
> >
> > i'll give it a shot with 5.0.8-SNAPSHOT though
> >
> > On Dec 28, 2007, at 11:03 AM, Howard Lewis Ship wrote:
> >
> > > Thanks, will look into this.
> > >
> > > On Dec 27, 2007 6:59 PM, yuan gogo <go...@gmail.com> wrote:
> > >> I got t5.0.7 this morning. As I'm a Chinese user, I use utf-8
> > >> encoding for
> > >> my application.
> > >>
> > >> But, while upload file and some text, I got this:
> > >>
> > >> java.lang.NullPointerException: charsetName
> > >>
> > >>        java.lang.String.<init>(String.java:442)
> > >>        java.lang.String.<init>(String.java:516)
> > >>
> > >> org
> > >> .apache
> > >> .commons.fileupload.disk.DiskFileItem.getString(DiskFileItem.java:
> > >> 349)
> > >>
> > >> org
> > >> .apache
> > >> .tapestry
> > >> .upload
> > >> .services
> > >> .MultipartDecoderImpl.processFileItems(MultipartDecoderImpl.java:117)
> > >>
> > >> org
> > >> .apache
> > >> .tapestry
> > >> .upload
> > >> .services.MultipartDecoderImpl.decode(MultipartDecoderImpl.java:65)
> > >>
> > >> $
> > >> MultipartDecoder_1171ead916b
> > >> .decode($MultipartDecoder_1171ead916b.java)
> > >>
> > >> $
> > >> MultipartDecoder_1171ead911d
> > >> .decode($MultipartDecoder_1171ead911d.java)
> > >>
> > >> org
> > >> .apache
> > >> .tapestry
> > >> .upload
> > >> .services
> > >> .MultipartServletRequestFilter
> > >> .service(MultipartServletRequestFilter.java:40)
> > >>
> > >> $
> > >> HttpServletRequestHandler_1171ead911f
> > >> .service($HttpServletRequestHandler_1171ead911f.java)
> > >>
> > >> $
> > >> HttpServletRequestHandler_1171ead911c
> > >> .service($HttpServletRequestHandler_1171ead911c.java)
> > >>
> > >> org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:164)
> > >>
> > >>
> > >> Alrough I solve this problem by add
> > >>    <filter>
> > >>        <filter-name>SetCharacterEncoding</filter-name>
> > >>        <filter-class>
> > org.springframework.web.filter.CharacterEncodingFilter
> > >> </filter-class>
> > >>        <init-param>
> > >>            <param-name>encoding</param-name>
> > >>            <param-value>utf-8</param-value>
> > >>        </init-param>
> > >>    </filter>
> > >>    <filter-mapping>
> > >>        <filter-name>SetCharacterEncoding</filter-name>
> > >>        <url-pattern>/*</url-pattern>
> > >>    </filter-mapping>
> > >>
> > >> in my web.xml.
> > >>
> > >> But I hope this can be handled by tapestry. And a NULL check for
> > >> charset
> > >> name is necessary.
> > >>
> > >> Thank you all !
> > >>
> > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > >
> > > Creator Apache Tapestry and Apache HiveMind
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
>



-- 
Korben Zhang
Blog: http://korben-zhang.blogspot.com | http://korbenzh.spaces.live.com

Re: T5.0.7 still can't resolve encoding.

Posted by Zsolt Salamon <sa...@gmail.com>.
I put this annotation to every page object.

@Meta(value = {"tapestry.response-content-type=text/html",  
"tapestry.response-encoding=ISO-8859-2"})
public class MyPageObject {
}

The encoding is ISO-8859-2 because my DB encoding that.

And in every language properties file I use unicode escape characters  
for every non-english character.
That's works for me so far.

Maybe this help for you.

On Jan 3, 2008, at 16:33, Korben Zhang wrote:

> Charset puzzled me too.
> I add Chinese resources file.
> But cannot show properly.
>
> I have tried:
> 1.add org.springframework.web.filter.CharacterEncodingFilter,  
> doesn't work;
>
> 2.native2ascii resource files, doesn't work;
>
> 3.add
>        configuration.add("tapestry.supported-locales", "en,zh");
>
> doesn't work;
>
> 4.
>    public static PageResponseRenderer decoratePageResponseRenderer(
>             @InjectService("PageMarkupRenderer")
>             final PageMarkupRenderer markupRenderer,
>             @InjectService("MarkupWriterFactory")
>             final MarkupWriterFactory markupWriterFactory, final  
> Object
> delegate)
>         {
>
>             return new PageResponseRenderer()
>             {
>                 public void renderPageResponse(Page page, Response  
> response)
> throws IOException
>                 {
>                     MarkupWriter writer =
> markupWriterFactory.newMarkupWriter();
>                     markupRenderer.renderPageMarkup(page, writer);
>                     PrintWriter pw = response.getPrintWriter("text/ 
> html;
> charset=UTF-8");
>                     writer.toMarkup(pw);
>                     pw.flush();
>                 }
>             };
>         }
>
> doesn't work;
>
> Is there a proposal method?
>
>
>
>
> On Dec 30, 2007 9:56 PM, yuan gogo <go...@gmail.com> wrote:
>
>> Thanks for answering.
>>
>> But I DID add this into my AppModule,  but the problem is still  
>> there.
>> I finanlly solved this by using Spring charset encoding filter.
>>
>>
>>
>> 2007/12/29, Michael Lake <ml...@netvue.com>:
>>>
>>>
>>> I'm also having this issue and i'm not even chinese.I did find this
>>> though:
>>>
>>> http://wiki.apache.org/tapestry/Tapestry5Utf8Encoding
>>>
>>> i'll give it a shot with 5.0.8-SNAPSHOT though
>>>
>>> On Dec 28, 2007, at 11:03 AM, Howard Lewis Ship wrote:
>>>
>>>> Thanks, will look into this.
>>>>
>>>> On Dec 27, 2007 6:59 PM, yuan gogo <go...@gmail.com> wrote:
>>>>> I got t5.0.7 this morning. As I'm a Chinese user, I use utf-8
>>>>> encoding for
>>>>> my application.
>>>>>
>>>>> But, while upload file and some text, I got this:
>>>>>
>>>>> java.lang.NullPointerException: charsetName
>>>>>
>>>>>        java.lang.String.<init>(String.java:442)
>>>>>        java.lang.String.<init>(String.java:516)
>>>>>
>>>>> org
>>>>> .apache
>>>>> .commons.fileupload.disk.DiskFileItem.getString(DiskFileItem.java:
>>>>> 349)
>>>>>
>>>>> org
>>>>> .apache
>>>>> .tapestry
>>>>> .upload
>>>>> .services
>>>>> .MultipartDecoderImpl.processFileItems 
>>>>> (MultipartDecoderImpl.java:117)
>>>>>
>>>>> org
>>>>> .apache
>>>>> .tapestry
>>>>> .upload
>>>>> .services.MultipartDecoderImpl.decode(MultipartDecoderImpl.java: 
>>>>> 65)
>>>>>
>>>>> $
>>>>> MultipartDecoder_1171ead916b
>>>>> .decode($MultipartDecoder_1171ead916b.java)
>>>>>
>>>>> $
>>>>> MultipartDecoder_1171ead911d
>>>>> .decode($MultipartDecoder_1171ead911d.java)
>>>>>
>>>>> org
>>>>> .apache
>>>>> .tapestry
>>>>> .upload
>>>>> .services
>>>>> .MultipartServletRequestFilter
>>>>> .service(MultipartServletRequestFilter.java:40)
>>>>>
>>>>> $
>>>>> HttpServletRequestHandler_1171ead911f
>>>>> .service($HttpServletRequestHandler_1171ead911f.java)
>>>>>
>>>>> $
>>>>> HttpServletRequestHandler_1171ead911c
>>>>> .service($HttpServletRequestHandler_1171ead911c.java)
>>>>>
>>>>> org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java: 
>>>>> 164)
>>>>>
>>>>>
>>>>> Alrough I solve this problem by add
>>>>>    <filter>
>>>>>        <filter-name>SetCharacterEncoding</filter-name>
>>>>>        <filter-class>
>>> org.springframework.web.filter.CharacterEncodingFilter
>>>>> </filter-class>
>>>>>        <init-param>
>>>>>            <param-name>encoding</param-name>
>>>>>            <param-value>utf-8</param-value>
>>>>>        </init-param>
>>>>>    </filter>
>>>>>    <filter-mapping>
>>>>>        <filter-name>SetCharacterEncoding</filter-name>
>>>>>        <url-pattern>/*</url-pattern>
>>>>>    </filter-mapping>
>>>>>
>>>>> in my web.xml.
>>>>>
>>>>> But I hope this can be handled by tapestry. And a NULL check for
>>>>> charset
>>>>> name is necessary.
>>>>>
>>>>> Thank you all !
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Howard M. Lewis Ship
>>>>
>>>> Creator Apache Tapestry and Apache HiveMind
>>>>
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> 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
>>>
>>>
>>
>
>
>
> -- 
> Korben Zhang
> Blog: http://korben-zhang.blogspot.com | http:// 
> korbenzh.spaces.live.com


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