Decode parameters in Java from ajax post with specials characters

I have a html page with a form, and the following code: $.ajax({ url: 'xxxxx', data: $('#contact-form').serialize(), type: 'post', cache: false, dataType: 'html', success: function (data) {....}, error: contact.error }); When i send a string by post from html page, for example, the string `áéíúó`, in Java I receive the string `áéíúó`. What should I do to resolve this problem? Any help will be very greateful. **(Date 20131401) Solution:** @TechSpellBound, thanks for your reply. Your solution motivated me to search another :D, well i found two more solutions that worked for me: 1) In Java, using the following code: String param = new String(req.getParameter("param").getBytes(), "iso-8859-1"); 2) Other solution was, in my Tomcat configure the file web.xml and put: setCharacterEncodingFilter org.apache.catalina.filters.SetCharacterEncodingFilter encoding UTF-8 true setCharacterEncodingFilter /* Then the file server.xml, put the property URIEncoding="UTF-8" in all connectors configured in. Thank you again.

以上就是Decode parameters in Java from ajax post with specials characters的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准