This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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 ]
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?
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.
Joined: Oct 17, 2006
Yeh you are right, I've changed it to UTF-16 and it solved the problem, 10X!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com