Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Charset and special characters

 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

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??

Any suggestions at all?
I am at a loss!

Sean
 
binayakumar patel
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sean,

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.

Regards
Binaya
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
♥ÐệªŦĥ›ßỹ‹§∑

Really it is any unusual character like those and of course loads and loads more. Typical characters £^$%&*(<> etc all work fine though.

I understand that you mean use the HTML entity name? This also does not work, as by the time I convert it in the servlet it is already '???'s

Any other suggestions?

It really is getting annoying!
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all get rid of this line of code:

It can't be doing anything useful and it's possible for it to be harmful. And you might want to read this article:

Character Conversions from Browser to Database
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Bill
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

thank you guys for your suggestions. I can't try them just now, but I will and I will let you know the outcome.

Try displaying the string character by character values in hex form.


Also William what do you mean by this? Sorry if it sounds like a stupid question.

Sean
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am thinking he is suggesting you display the hex value of each character that makes up he string.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

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.

Sean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic