Re: Does the form support utf-8? (T5)

2007-04-23 Thread Donyee

Thank you so much! Nick!
I will try to dig the code!
Cheers!

2007/4/23, Nick Westgate <[EMAIL PROTECTED]>:

Hi Will.

This isn't in T5 yet, but it can be added with a RequestFilter.
In your AppModule.cpp add the code below.

There may already be a "contributeRequestFilters" method,
but it _must_ be renamed to "contributeRequestHandler".
Note that the TimingFilter is optional - it is something
already present from the maven archetype project.

 public void contributeRequestHandler(OrderedConfiguration 
configuration,
 @InjectService("TimingFilter")
 RequestFilter timingFilter,
 @InjectService("Utf8Filter")
 RequestFilter utf8Filter)
 {
 configuration.add("Utf8Filter", utf8Filter);
 configuration.add("Timing", timingFilter);
 }

 public RequestFilter buildUtf8Filter(
 @InjectService("RequestGlobals")
 final RequestGlobals requestGlobals)
 {
 return new RequestFilter()
 {
 public boolean service(Request request, Response response, 
RequestHandler handler)
 throws IOException
 {
 
requestGlobals.getHTTPServletRequest().setCharacterEncoding("UTF-8");
 return handler.service(request, response);
 }
 };
 }

Cheers,
Nick.


Donyee wrote:
> Hey , may  I ask  another  question? How to read  a utf-8 char from
> the form?  a TextField? I fill the form with a utf-8 char,then it
> couldn't display right!
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Chinese name:徐 依伟
English name: will


Re: Does the form support utf-8? (T5)

2007-04-23 Thread Nick Westgate

Hi Will.

This isn't in T5 yet, but it can be added with a RequestFilter.
In your AppModule.cpp add the code below.

There may already be a "contributeRequestFilters" method,
but it _must_ be renamed to "contributeRequestHandler".
Note that the TimingFilter is optional - it is something
already present from the maven archetype project.

public void contributeRequestHandler(OrderedConfiguration 
configuration,
@InjectService("TimingFilter")
RequestFilter timingFilter,
@InjectService("Utf8Filter")
RequestFilter utf8Filter)
{
configuration.add("Utf8Filter", utf8Filter);
configuration.add("Timing", timingFilter);
}

public RequestFilter buildUtf8Filter(
@InjectService("RequestGlobals")
final RequestGlobals requestGlobals)
{
return new RequestFilter()
{
public boolean service(Request request, Response response, 
RequestHandler handler)
throws IOException
{

requestGlobals.getHTTPServletRequest().setCharacterEncoding("UTF-8");
return handler.service(request, response);
}
};
}

Cheers,
Nick.


Donyee wrote:

Hey , may  I ask  another  question? How to read  a utf-8 char from
the form?  a TextField? I fill the form with a utf-8 char,then it
couldn't display right!





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Does the form support utf-8?

2007-04-23 Thread Donyee

Hey , may  I ask  another  question? How to read  a utf-8 char from
the form?  a TextField? I fill the form with a utf-8 char,then it
couldn't display right!


--
Chinese name:徐 依伟
English name: will