Thank you. Your way is right!

2008/3/11, Yoshikazu Kuramochi <[EMAIL PROTECTED]>:
>
> The same problem occurs by using japanese characters.
>
> org.apache.tapestry.upload.internal.services.MultipartServletRequestFilt
> er
> is executed before the Utf8Filter written in the wiki page.
> So request.getCharacterEncoding() returns null
> in org.apache.tapestry.upload.internal.services.MultipartDecoderImpl,
> and the default character encoding is used to decode field values.
>
> As follows I resolved the problem:
>
>      * Utf8Filter implements HttpServletRequestFilter, instead of
> RequestFilter.
>      * Add the filter before MultipartFilter.
>
>
>      public HttpServletRequestFilter buildUtf8Filter()
>      {
>          return new HttpServletRequestFilter()
>          {
>              public boolean service(HttpServletRequest request,
> HttpServletResponse response,
>                      HttpServletRequestHandler handler) throws
> IOException
>              {
>                  request.setCharacterEncoding("UTF-8");
>                  return handler.service(request, response);
>              }
>          };
>      }
>
>      public void contributeHttpServletRequestHandler(
>              OrderedConfiguration<HttpServletRequestFilter>
> configuration,
>              @InjectService("Utf8Filter")
>              HttpServletRequestFilter utf8Filter)
>      {
>          configuration.add("Utf8Filter", utf8Filter,
> "before:MultipartFilter");
>
>      }
>
>
>
> On 2008/03/11, at 11:03, Angelo Chen wrote:
>
> >
> > Hi Yuan,
> >
> > I'm not using Spring, will this work too?
> >
> >
> > yuan gogo wrote:
> >>
> >> I use spring.
> >> And config it in web.xml
> >>
> >>     <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>
> >>
> >> This makes the text fields with file-upload work in correctly!
> >>
> >>
> >>
> >> 2008/3/7, Angelo Chen <[EMAIL PROTECTED]>:
> >>>
> >>>
> >>> Hi Yuan,
> >>>
> >>> yes, the problem now is, file upload, if you have a textfield
> >>> mixed with
> >>> file upload, the input will have garbage.
> >>>
> >>>
> >>>
> >>> yuan gogo wrote:
> >>>>
> >>>> This problem has been resolved.
> >>>>
> >>>> I'm Chinese too :-)
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/T5%3A-Chinese-in-form-submission%285.0.11%
> >>> 29-tp15866978p15890060.html
> >>>
> >>> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>> --------------------------------------------------------------------
> >>> -
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>
> >>
> >
> > --
> > View this message in context: http://www.nabble.com/T5%3A-Chinese-
> > in-form-submission%285.0.11%29-tp15866978p15973133.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>

Reply via email to