Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

₪ character displayed as ?

 
Andrew Carney
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am fetching a certain String from the Database which also contains this special character: ₪ (it is the coin sign for the Israeli shekel, the same as $ for the US).
The problem is that these characters appear on the screen as ? instead of ₪. At the Database itself they appear as they should: ₪. Which manipulation should be done on the string in order to present it correctly?
[ October 31, 2006: Message edited by: Roy Cohen ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends how you are making them appear on the screen. Whatever applicaiton you are using to make them appear needs to be using a character set that supports the shekel. Have a read of this.
 
Andrew Carney
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

I am familiar with this link, I am indeed saving it as an HTML with UTF-8 but it doesn't help. I did try a different thing now:
I created a simple static HTML file using editplus and entered the sign into it.
When I saved this file editplus announced me that I have characters that can be lost using the current encoding and when I select to save the file using 'Unicode' encoding I can see the sign on the HTML page.
This change that editplus made did not affect the HTML code, so I assume I need to save the HTML file I am writing into in a 'Unicode' encoding.
Could you please suggest me how to do it in Java?

Thank you in advance,
Roy
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM has a property called file.encoding which defines which encoding is used when streaming out to a file. Unless you tell it otherwise it will use this encoding. Have a look at OutputStreamWriter - it has various constructors that allow you to specify the character set to use. Make it UTF-8 or whatever and you should be OK.
 
Andrew Carney
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeh you are right, I've changed it to UTF-16 and it solved the problem, 10X!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic