Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Ajax problem

  1. Apr 22, 2007 #1
    When I using ajax to gather information from a webpage , it show ������� for the chinese character , but when i run the webpage separately it can show the right character.
    I use responseText to gather information and use innerHTML to show on the webpage.What is the problem ?Do i need to set the encoding using javascript , but how ?
  2. jcsd
  3. Apr 22, 2007 #2


    User Avatar
    Science Advisor

    That's probably because when javascript receives the text string returned from the server it interprets it as ASCII. As far as i know Javascript will only interpret a character string as Unicode if the characters are appropriately escaped. For example, unicode characters in Javascript use the following escape sequence:
    Where #### is a valid hexadecimal digit, such as :
    Code (Text):

    alert("This is a unicode character: \u8880");
    You might need to escape each character appropriately at the server if you want to use Ajax. Maybe you can use an IFrame instead.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Ajax problem
  1. Ajax Problem (Replies: 15)

  2. Problems with zheev (Replies: 4)

  3. Jquery AJAX input (Replies: 1)

  4. Javascript problem (Replies: 6)

  5. Problem with dgesv (Replies: 5)