SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy ajax + chinese characters

    hi there..i hsve some problem about the Ajax + chinese characters...

    i m using the ajax script to pass the form value through a URL to a asp files to execute the update sql. i have pass a chinese characters "日出" through the ajax , such as below..
    Code:
                    url= url + "&formvalue=" +formvalue;
    	xmlHttp.open("GET",url,true);
    	xmlHttp.send(null);
    	xmlHttp.onreadystatechange=stateChanged;
    but when i save it in the databse, it save the "日出" to "??" and when i display out it also show "??" since in the DB the record is saved as "??"

    anyone can give me a hand? i m very confuse for tis problem.
    plz give me a hand. thank you

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to make sure that you're using the same character encoding all through the chain, or take care to convert characters properly if you're not.

    If you're dealing with user input it gets even trickier.
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hie there..can u explain more detailed? coz i m not quite understand..thank yoy

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See The Definitive Guide to Web Character Encoding if you're not familiar with the topic.

    A character, especially those outside the English alphabet, can be represented by different numeric values in different encodings. If the encoding used in your database doesn't match the encoding you use for your web page, then the characters won't render properly.
    Birnam wood is come to Dunsinane


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
  •