Pregunta

I have text in a mysql database which is correctly holding the Euro symbol. What I am trying to do is create an array entry in javascript that will be used to populate a text area when a user selects an option from a drop down. Currently what I have is:

var cannedResponses = new Object();
<c:forEach items="${pageModel.cannedResponses}" var="cannedResponse" varStatus="status">
cannedResponses["${cannedResponse.id}"] = "${cannedResponse.response}";
</c:forEach>

This adds all of the canned responses to the array but when I view source I can already see that the Euro symbol is a ?, and when it populates the text area it is still a ?. I can see when debugging that the Euro symbol is correctly set in the response String in the servlet so I know it is correct until this point.

Any help in how to make this appear correctly when loaded into the HTML would be appreciated

Thanks

¿Fue útil?

Solución

Your problem appears to be the character encoding of the returned file. The question mark indicates that it's ASCII, but you should set it to UTF-8. There are several settings you need to check: 1) the encoding settings of the JSPs served by your web/app server, 2) the actual encoding of the jsp file on the file system (use features of Notepad++ or Textpad to check the encoding of the file). 3) the encoding set inside the jsp itself.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top