• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Charset and special characters

 
Rancher
Posts: 377
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic