Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 496339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:40:37+00:00 2026-05-13T05:40:37+00:00

two days ago i started using tomahawk ExtensionsFilter components im my jsf application. i

  • 0

two days ago i started using tomahawk ExtensionsFilter components im my jsf application.
i noticed that all javascript alerts were not displaying special characters (ç, ã, ó ô), it displays things like #231 instead.
When i remove ExtensionsFilter from my web.xml file, javascript displays allright.
Anybody had this issue before?

thanks in advance.

EDIT:
i was able to solve the problem by creating a filter before the extensionFilter, this new filter force the REQUEST charset to utf-8. But this is an ugly solution, a better solution, as balusC said, would be to get rid of all the inline javascript.

Thank you all for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:40:37+00:00Added an answer on May 13, 2026 at 5:40 am

    A few other ideas:

    • add filter which calls setContentType or setCharacterEncoding and which is before all other filters
    • set the property -Dfile.encoding
    • rebind the javascript window.alert so that it escapes the characters

    This seems to work, but would be a very, very ugly hack. This would also be very limited and won’t work if javascript sets other texts, e.g. content of a div.

    var hack = window.alert;
    window.alert = function( text ) {
        hack( text + ' was converted' );
    };
    alert('hello');
    

    UPDATE:

    Here is the sequence that is suspect:

    1) ExtensionsFilter intercepts the request

    2) ExtensionsFilter contains

      154   // only parse HTML responses
      155   if (extendedResponse.getContentType() != null && isValidContentType(extendedResponse.getContentType()))
      156   {
            ...
      172        // writes the response
      173        addResource.writeResponse(extendedRequest, servletResponse);
      174    }
      175   else
      176   {
      178        byte[] responseArray = extendedResponse.getBytes();
      180        if(responseArray.length > 0)
      181       {
      182       // When not filtering due to not valid content-type, deliver the byte-array instead of a charset-converted string.
      183       // Otherwise a binary stream gets corrupted.
      184       servletResponse.getOutputStream().write(responseArray);
      185     }
    

    3) DefaultAddResource uses HtmlResponseWriterImpl which uses UnicodeEncoder.

    4) All “non basic latin characters” are then encoded.

    Conclusion

    • if you set the content type to something invalid, the ExtensionsFilter will default to the “else” branch and won’t encode the response. But, then the ExtensionsFilter is probably broken.
    • changing setCharacterEncoding has probably no effect, neither the file.encoding
    • creating an extra filter to wrap again the response and revert some of the &#xx; could work but is extremely ugly.

    I don’t have other ideas right now, but I’m interested in the answer as I also bumped on encoding issue which were annoying.


    UPDATE 2:

    You could give a try to AspectJ to alter just the part of the MyFaces library that relates to the encoding form within the filter. According to my understanding of cflow and the call pointcut pickings, something like this might intercept the encoding when it happens from the filter. If this definition creates other interferences in the request processing, you might want to also consider the call to addResource.writeResponse to limit further the pointcut.

    public aspect SkipEncoding {  
        pointcut encodingInExtFilter() : 
            cflow( * org.apache.myfaces.webapp.filter. ExtensionsFilter.doFilter(..) ) && 
            call ( String UnicodeEncoder.encode( String, bool, bool ));   
        around( String s, bool b1, bool b2 ) : encodingInExtFilter
        {
            return s; // skip encoding
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.