Results 1 to 2 of 2
- 08-20-2009, 02:37 AM #1Member
- Join Date
- Aug 2009
- Rep Power
Certain Chinese Characters not displayed properly.
We are retrieving Chinese data from a file and displaying it to our web page. However, for some reason, certain chinese characters are destroyed, thus resulting to 3 different characters instead of 1 character.
I found out that:
If we directly copy the bytes from the file into a new file, the chinese chars can be viewed properly in our web browser.
If we save the bytes into a new String, the chinese is displayed properly but 1 or 2 characters are destroyed (displaying 3 different garbage characters each).
Any idea on how to resolve this? Any help will be appreciated.
Thanks and Regards,
- 08-21-2009, 05:55 AM #2
Java handles characters using UTF-16, which is very general. However, the characters are typically transformed to another character set before transmission. The browser's font must also be able to render the characters properly in the browser. Possibly, the characters are being mangled during this process, or the font is not interpreting it properly.
In addition, some UTF characters require more than 16 bits, so they look like multiple characters if misinterpreted. Check the representation of the specific characters and see if they are defined in the normal UTF-16 range, or if they require two or three char's to represent.
- By dhandapanik in forum EclipseReplies: 1Last Post: 08-21-2009, 08:07 PM
- By bngkrish in forum Java ServletReplies: 0Last Post: 04-19-2009, 06:38 PM
- By xgi1008 in forum New To JavaReplies: 18Last Post: 10-05-2008, 07:03 PM
- By vaskarbasak in forum AWT / SwingReplies: 3Last Post: 06-26-2008, 08:27 AM
- By vaskarbasak in forum Advanced JavaReplies: 1Last Post: 06-10-2008, 07:49 AM