0

I've been trying to read non-English (Persian) parameters from a URL but as it gets it changes it to some non-sense characters . I can make sure that the side that is sending this paramer is not the problem . and I've also made the right collation in the MySQL database so that it actually stores them if it receives them properly. I'm running this on Tomcat Server as it was working fine on the local host. Here is what I used for pom.xml :

 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

And here's what its used for web.xml :

 <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>

And also this one for the Tomcat server.xml:

URIEncoding="UTF-8" useBodyEncodingForURI="true"

I've also tried to send the post request via UTF8 Charset added to the Header and didn't solve it.

Thanks for your help.

uoyilmaz
  • 3,035
  • 14
  • 25
Mahan
  • 147
  • 1
  • 3
  • 14
  • In what encoding is your page and what encoding do you have in html `meta` tag? – ledniov Jun 17 '17 at 08:42
  • @ledniov there is no page , just when thr data is recieved from app to the web servicea its messed up , i fixed it by writing an toUTF8 method and used it on params i. needed to be fixed before it was gonna be used anywhere – Mahan Jun 17 '17 at 09:55
  • what is your connection string? do you have `characterEncoding=UTF-8` there? – ledniov Jun 19 '17 at 06:56
  • Also please refer to this question - https://stackoverflow.com/questions/44588055/spring-boot-cant-save-unicode-string-in-mysql-using-spring-data-jpa – ledniov Jun 19 '17 at 06:57
  • @lednioc yea I've got that its something like this http://IP/app/something?nonEnglishParam. , when its received on spring its messed so i put a custom toUTF8 function in its way before using it and its fixed , as i said its working fine on local and it maybe the server system locale things cause all things needed are mentioned for tomcat and the project .. – Mahan Jun 19 '17 at 07:03
  • @lednioc yea I've got that its something like this http://IP/app/something?nonEnglishParam. , when its received on spring its messed so i put a custom toUTF8 function in its way before using it and its fixed , as i said its working fine on local and it maybe the server system locale things cause all things needed are mentioned for tomcat and the project .. – Mahan Jun 19 '17 at 07:05
  • so you just entering an URL in a browser to test? What headers are sent to the server? – ledniov Jun 19 '17 at 08:02
  • check also this answer - https://stackoverflow.com/a/138950/1126831 – ledniov Jun 19 '17 at 08:05
  • @ledniov browser, postman , android app , tested all with the header Charset:UTF8 , and I've checked the link and I've added them all , not working – Mahan Jun 19 '17 at 08:10
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/147032/discussion-between-ledniov-and-mahan). – ledniov Jun 19 '17 at 08:17

0 Answers0