SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    Toronto
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multibyte characters causing errors (Chinese)

    I have a Chinese langugage string hardcoded in my javascript and some of the characters have their second byte the same as the \ character. If the webpage is viewed with Chinese encoding then there is no problem. However, if the page is viewed in iso-8859-1 then the \ character will cause a javascript error. I can fix that by adding an extra \ so it is escaped. But then it will cause error in Chinese encoding again because of the extra \ .....
    Is there any way I can make this work in both encoding??

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What are you doing with this unicode? Writing it to the page? Inserting it into a textarea?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    Toronto
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The string on the file is in Chinese Big5 coding. I'm going to insert it to either textarea, text input, and drop down menus.

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try using "UTF-8" instead of "ISO-8859-1"
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





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
  •