Results 1 to 9 of 9

Thread: problem with chinese characters

  1. #1
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default problem with chinese characters

    I want to add a chinese page to my site, set the charset to UTF-8 but after uploading to the server the chinese characters don't display correctly. What am I doing wrong? When tested locally on my browser before uploading, the characters are display correctly.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>chinese characters</title>
    </head>

    <body>
    <b>Chinese characters in UTF-8</b><br/>
    Simplified characters: 简体中文网页<br/>
    Traditional characters: 繁體中文網頁<br/>
    </body>
    </html>

    Any idea? Thanks for your help.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Check the encoding of the text file itself. The .htm/.txt/etc file may be set to some other encoding and distorting your characters that way.
    Daniel - Freelance Web Design | <?php?> | <html>| espaol | Deutsch | italiano | portugus | catal | un peu de franais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    I've read in different places that the correct charset for chinese characters is UTF-8. I'm sorry, I don't understand what you mean.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    There are two different ways to set a character encoding:
    1. You can include the information in the HTML code, like you have above.
    2. You can set the file itself (as an attribute of the file, not code in the file) to that encoding.

    Both must match for it to work.

    In notepad I believe you can use save as... and select a new encoding if needed.

    It's possible that the upload process is changing the encoding of the file, but that is unlikely and might be hard to fix, so see if the simpler answer works first.


    Short version: character encodings are not stored in only one place; they must all match.
    Daniel - Freelance Web Design | <?php?> | <html>| espaol | Deutsch | italiano | portugus | catal | un peu de franais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    I'm using dreamweaver CS5.5. I'm sorry but I don't understand point number 2. Can you give me an example?

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I've just been experimenting with this, and using any encoding for the file that supports these characters (Chinese, simplified Chinese, big or small endian), if the page is served as UTF-8, it still works. It might be that the server is overriding the charset declared on the page. When that happens you can get:

    Simplified characters: €“*–‡‘页
    Traditional characters: 繁”*–‡網
    or:

    Chinese characters in UTF-8
    Simplified characters: ^I?
    Traditional characters: c餤*
    etc. If saved in one of the supporting encodings and served as charset=iso-8859-1 or another ANSI only charset.

    The server can override the charset. PHP and other methods can be used to force the server to use the preferred encoding or at least respect the declaration on the page. If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. The Following User Says Thank You to jscheuer1 For This Useful Post:

    paldo (02-11-2014)

  8. #7
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,875
    Thanks
    49
    Thanked 263 Times in 255 Posts
    Blog Entries
    56

    Default

    If nothing helps, you can use this converter (to Unicode). Just put Chinese tekst in it.

  9. The Following User Says Thank You to molendijk For This Useful Post:

    paldo (02-11-2014)

  10. #8
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Genius !!! It works your way. Many thanks.

  11. #9
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Thank you John. Most probably, as you said, the server is overriding the charset. I thought it might be the browser. I will contact the server provider and see if something can be changed.

    I've used the suggested converter of Arie (Molendijk) and it works perfectly.

    Thank you to all of you for your help.

Similar Threads

  1. problem with characters...
    By jonybigude in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 05-14-2011, 10:54 PM
  2. Fix to problem displaying RSS feed with accented characters
    By robokev in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 09-22-2008, 05:03 AM
  3. Ajax Tabs Content Script - problem with non alpha-numeric characters
    By masamasa in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 07-25-2008, 02:54 PM
  4. Diplaying Chinese Characters
    By devtechchina in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 07-13-2007, 11:02 PM
  5. Chinese Language
    By ashhad4u in forum JavaScript
    Replies: 1
    Last Post: 08-12-2005, 11:27 PM

Bookmarks

Posting Permissions

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