You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Bayarsaikhan VOLODYA <ba...@gmail.com> on 2005/08/26 15:38:26 UTC

encoding problem

hi,

i have an encoding problem. in my velocity.properties

input.encoding=UTF-8
output.encoding=UTF-8

and i cannot get Turkish(ISO-8859-9) inputs from text fields. it becomes 
something like this : ÜĞP,İŞ.Ö

when i change my velocity.properties to

input.encoding=ISO-8859-9
output.encoding=ISO-8859-9

all turkish characters become : ???????


what can i do?


-- 
Bayarsaikhan VOLODYA

Re: encoding problem

Posted by Bayarsaikhan VOLODYA <ba...@gmail.com>.
i solved my prob :) it was really nothing to do with velocity. 
by using a simple UTF filter.

public class UTFFilter implements Filter {

public void destroy() {
}

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
chain.doFilter(request, response);
}

public void init(FilterConfig arg0) throws ServletException {
}
}

On 8/28/05, Daniel Dekany <dd...@freemail.hu> wrote:
> 
> Friday, August 26, 2005, 3:38:26 PM, Bayarsaikhan VOLODYA wrote:
> 
> > hi,
> >
> > i have an encoding problem. in my velocity.properties
> >
> > input.encoding=UTF-8
> > output.encoding=UTF-8
> >
> > and i cannot get Turkish(ISO-8859-9) inputs from text fields. it becomes
> > something like this : ÜĞP,İŞ.Ö
> >
> > when i change my velocity.properties to
> >
> > input.encoding=ISO-8859-9
> > output.encoding=ISO-8859-9
> >
> > all turkish characters become : ???????
> >
> >
> > what can i do?
> 
> Look as when the Servlet container decodes the input with the wrong
> charset (so it has nothing to do with Velocity), probably with
> ISO-8859-1. To fix this, you have to call
> ServletRequest.setCharacterEncoding
> (theEncodingOfTheHTMLThatContainsTheForm).
> This call must be done before any parameter is read from the
> ServletRequest, or else it has no effect.
> 
> --
> Best regards,
> Daniel Dekany
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 


-- 
Bayarsaikhan VOLODYA

Re: encoding problem

Posted by Daniel Dekany <dd...@freemail.hu>.
Friday, August 26, 2005, 3:38:26 PM, Bayarsaikhan VOLODYA wrote:

> hi,
>
> i have an encoding problem. in my velocity.properties
>
> input.encoding=UTF-8
> output.encoding=UTF-8
>
> and i cannot get Turkish(ISO-8859-9) inputs from text fields. it becomes
> something like this : ÜĞP,İŞ.Ö
>
> when i change my velocity.properties to
>
> input.encoding=ISO-8859-9
> output.encoding=ISO-8859-9
>
> all turkish characters become : ???????
>
>
> what can i do?

Look as when the Servlet container decodes the input with the wrong
charset (so it has nothing to do with Velocity), probably with
ISO-8859-1. To fix this, you have to call
ServletRequest.setCharacterEncoding(theEncodingOfTheHTMLThatContainsTheForm).
This call must be done before any parameter is read from the
ServletRequest, or else it has no effect.

-- 
Best regards,
 Daniel Dekany


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org