1 Reply Latest reply on May 30, 2007 12:38 AM by Anvar Sart

    How to define default encoding ?

    Anvar Sart Newbie

      Hello =))
      I wondering where can i define default page charset and encoding ?

      I tryed to set PhaseListener

      public class EncodingPhaseListener implements PhaseListener {
       private static final long serialVersionUID = - 5249591857614335618L;
       private static final String ENCODING = "UTF-8";
       public void afterPhase (final PhaseEvent event) {
       public void beforePhase (final PhaseEvent event) {
       try {
       ((ServletRequest) FacesContext.getCurrentInstance ().getExternalContext ().getRequest ()).setCharacterEncoding (ENCODING);
       ((ServletResponse) FacesContext.getCurrentInstance ().getExternalContext ().getResponse ()).setCharacterEncoding (ENCODING);
       } catch (final UnsupportedEncodingException e) {
       public PhaseId getPhaseId () {
       return PhaseId.ANY_PHASE;


      but it's not working....

      best regards

        • 1. Re: How to define default encoding ?
          Anvar Sart Newbie

          And i tryed to set filter but it's eather do not work.

          import javax.servlet.*;
          import java.io.IOException;
          public class EncodingFilter implements Filter{
           public void destroy(){ }
           public void doFilter(ServletRequest req, ServletResponse resp,
          FilterChain chain) throws ServletException, IOException{
           chain.doFilter(req, resp);
           public void init(FilterConfig config) throws ServletException
          { }



          please, someone help =))