GithubHelp home page GithubHelp logo

"UTF-8" Encoding problem about hdiv HOT 10 CLOSED

hdiv avatar hdiv commented on June 29, 2024
"UTF-8" Encoding problem

from hdiv.

Comments (10)

gillarramendi avatar gillarramendi commented on June 29, 2024

Hi Youssef,

we have detected the source of error: InitListener is executed before CharacterEncodingFilter and we read some parameter from the request. This causes the new encoding (UTF-8) does not apply.

We are working to find a solution.

Thanks for the complete information

from hdiv.

youssefguenoun avatar youssefguenoun commented on June 29, 2024

Hi Gotzon,
OK thank's for the diagnostic !

So, we'll wait your solution :-)

Regards,

from hdiv.

youssefguenoun avatar youssefguenoun commented on June 29, 2024

I fixed the problem with this dirty patch :

public class InitListenerFixEncoding extends InitListener {
private static final Logger LOGGER= LoggerFactory.getLogger(InitListenerFixEncoding.class);
@OverRide
public void requestInitialized(ServletRequestEvent sre) {
HttpServletRequest request = (HttpServletRequest) sre.getServletRequest();
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
LOGGER.debug("Encoding UTF-8 is not supported !",e);
}
super.requestInitialized(sre);
}
}

But ideally InitListner must be executed after CharacterEncodingFilter !

Regards,
Youssef

from hdiv.

 avatar commented on June 29, 2024

Thanks Youssef, your solution worked for me too.

from hdiv.

gillarramendi avatar gillarramendi commented on June 29, 2024

Issue resolved in trunk with this commit: 3cacefb

Now request is not 'touched' in InitListener and CharacterEncodingFilter works correctly.

Thanks for your help!

from hdiv.

youssefguenoun avatar youssefguenoun commented on June 29, 2024

Cool Thanks !! we're waiting for the release ;o)

from hdiv.

mlegnani avatar mlegnani commented on June 29, 2024

Hi all,
I had the same problem, then I applied your patch and initially it seemed to work but now I have a new problem: when a special character is sent trough an hidden field, HDIV detects it to be changed (while it is not).
Here is mi code:
in the jsp:
<form:hidden path="nomeAzienda" />

the value of "nomeAzienda" is è-test and this is hdiv log message

20130318 095738 INFO org.hdiv.logs.Logger INVALID_PARAMETER_VALUE;/myapp/pratiche/savempart.html;nomeAzienda;è-test;0:0:0:0:0:0:0:1;0:0:0:0:0:0:0:1;user

Did you find a solution to this problem?
Thanks a lot
Massimo

from hdiv.

gillarramendi avatar gillarramendi commented on June 29, 2024

Hi Massimo,

resolved on the trunk: 2134eda

Thank you!

If you cant update to the last snapshot of HDIV you can disable content escaping in the hidden field as a temporal fix:

<form:hidden path="username" htmlEscape="false"></form:hidden>

from hdiv.

mlegnani avatar mlegnani commented on June 29, 2024

Thanks a lot! When do you think the new release will be available?

from hdiv.

gillarramendi avatar gillarramendi commented on June 29, 2024

Hi,

Hdiv 2.1.4 release is public on Maven repositories: http://search.maven.org/#artifactdetails%7Corg.hdiv%7Chdiv%7C2.1.4%7Cpom

Regards

from hdiv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.