wood burning stoves 2.0*
The moose likes Java in General and the fly likes ₪ character displayed as ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "₪ character displayed as ?" Watch "₪ character displayed as ?" New topic
Author

₪ character displayed as ?

Andrew Carney
Ranch Hand

Joined: Oct 17, 2006
Posts: 96
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

Joined: Apr 14, 2004
Posts: 10336

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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Andrew Carney
Ranch Hand

Joined: Oct 17, 2006
Posts: 96
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

Joined: Apr 14, 2004
Posts: 10336

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

Joined: Oct 17, 2006
Posts: 96
Yeh you are right, I've changed it to UTF-16 and it solved the problem, 10X!
 
wood burning stoves
 
subject: ₪ character displayed as ?
 
Similar Threads
Regular Expression with java
checking if two character appear in a string
Can i save "தமிழ்" in Database assuch
convert uft-8 into ascii format
UTF vs Unicode (JQ+)