Results 1 to 2 of 2
  1. #1
    kerwintang is offline Member
    Join Date
    Aug 2009
    Rep Power

    Default 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,

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Rep Power


    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.

Similar Threads

  1. Replies: 1
    Last Post: 08-21-2009, 09:07 PM
  2. Replies: 0
    Last Post: 04-19-2009, 07:38 PM
  3. this looks chinese to me
    By xgi1008 in forum New To Java
    Replies: 18
    Last Post: 10-05-2008, 08:03 PM
  4. Displaying Chinese characters on Swing components
    By vaskarbasak in forum AWT / Swing
    Replies: 3
    Last Post: 06-26-2008, 09:27 AM
  5. drawString with Chinese Characters
    By vaskarbasak in forum Advanced Java
    Replies: 1
    Last Post: 06-10-2008, 08:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts