This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I really need some help if anyone can give it to me.
Basically whenever I try to read any special characters from my web application they come up as question marks ???.
I have the application running locally on a tomcat installation and it works fine, however when I move it to the live environment (which is managed hosting) I get this problem, I am setting the content type to UTF-8. Code looks like this:
I decided to check what the default charset was by using:
On the one that works the charset was UTF-8 and on the other it was US-ASCII.
Does anyone know if that is the problem??
Can you please give the screen shot , as well as the special character with which you have the problem.
Because when ever we try to display character like '>' we use "& gt"
So I think you need to convert your special code in this form to read this.
Note that seeing ??? on the screen does NOT necessarily mean that the app is trying to show the ASCII question mark. It may mean that your system simply doesnt have a font to show the special character.
Try displaying the string character by character values in hex form.
A quick update, I was about to try some of your suggestions. But before I did I thought I'd test it again.
For some reason my when using:
My server is now outputting UTF-8 instead of US-ASCII which it was doing the other day and now everything works fine (so it seems that this was the problem).
My worry is that this is going to change again on it's own (or without me doing anything since this is hosted in a managed environment).
Anyway it works for now, thanks for your suggestions.