• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tweak Character Encoding to UTF-8 only for one request

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an application with Web Work + Spring + Hibernate.

I have defined webwork.i18n.encoding=ISO8859-1 in webwork.properties file.

I chose 'ISO-8859-1' encoding because i wanted to save special characters in my database.

In one particular case, i send my request(form with hidden variables ) to a third party drafter..which has character encoding set to "UTF-8".

Now whenever i pass the request (which contains special characters) from my application to the third party, first time it shows the correct special character, but on subsequent request, it gives me a '?' or a rectangular box.

If we start a new browser instance everytime then it shows up properly.

I tried the following -
I tried to do in my filter


It does change the request encoding, till the time it calls FilterDispatcher.java where in it reads from webwork.properties and changes the character encoding back to "ISO-8895-1".

What should i do now?

Is there any way to tweak FilterDispatcher for one particular request?



Thanks.
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Imagining you were working with struts2. You can set this in struts.properties file.


if you want to override it to a particular request then you have to override FilterDispatcher(Use StrutsPrepareAndExecuteFilter).
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohana Rao Sv wrote:Imagining you were working with struts2. You can set this in struts.properties file.


if you want to override it to a particular request then you have to override FilterDispatcher(Use StrutsPrepareAndExecuteFilter).



We are using WebWorks.

I tried overriding FilterDispatcher with TestFilter.java.
In my web.xml I configured this filter for a particular request.
On request, doFilter() method of TestFilter does get called, but at the end , doFilter() method of FilterDispatcher gets called. So i end up without my encoding being changed.

Is this the right way to do it? I think I am doing something wrong.

Here is my code -




 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deeps,
Never worked on WebWorks. Have you seen this thread
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shankar Tanikella wrote:Hi Deeps,
Never worked on WebWorks. Have you seen this thread



Thanks for your quick reply.

In my case , it is reading webwork.i18n.encoding=ISO8859-1 in the FilterDispatcher.java.

I want it to bypass it for one particular request.


Thanks.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic