Reputation: 2007
I am having a charset problem with literal string in Java.
As you can see at image below, I have a static object called TITULO with a literal string constant parameter "Título". When I run the program, this String is readed as "TÃ-tulo". I don't know why.
I explore the charset settings at Eclipse Project Properties Window and Tomcat settings but all them are with UTF-8 as a option.
I'm running Tomcat 7, Eclipse Helios and Windows SO.
Can anyone help me with this issue?
Upvotes: 9
Views: 1163
Reputation: 2007
The code that is in eclipse editor is not the same of the code that tomcat is executing.
I found a .war file at /target folder. I deleted this war file and works! The tomcat was running the classes from this old war file.
I have recently converted this running eclipse project to a maven project. I may have executed 'mvn package' at this process that created this war file.
Thanks all for help me found this solution.
Upvotes: 1
Reputation: 2020
You might try setting the Tomcat URIEncoding to UTF-8 in the server.xml
<Connector port="8090" URIEncoding="UTF-8"/>
Upvotes: 1
Reputation: 7952
I believe that the string you are looking (this.id) at is not actually the static constant string Titulo.
Somewhere in your code, you are reading the proper unicode String Titulo, converting it to a byte array, then converting it back to a String and passing it to the constructor of Style. The string is getting corrupted during the conversion. Can't say more unless you show the stack trace of the code where you call the constructor of Style.
Upvotes: 0