Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

IE/Netscape UTF-8 encoding not working for AJAX

chief555chief555 Posts: 3Member
I have a survey-design site that I've built for my company where a
user can create any questions/answers, etc and have someone take a
survey online. The company now wants it multi-lingual-capable, so
we've been including this capability and it's been going pretty well.

The scenario is that we have a survey question and the user would
click on a button/image that calls the AJAX and comes back with the
question in all of the other languages that they might have as part
of their survey design so that they could edit any one individually
without having to carry the survey around in all possible languages
which could slow things down quite a bit with a 50-question
survey---the ajax comes back with the currently selected question
(only) in all of the languages that the designer might be using.
They can then make changes to one of those in a text or textarea
field and when the control loses focus, it saves (again using ajax)
and comes back to display that it was saved and shows the new
question.

I started using the AJAX capabilities and everything works great
except for the encoding with internet explorer 6x (and netscape
navigator 7x)--seem to come back (to the server) as a bunch of
question marks: ????? when I submit some Chinese. It also blows up
with certain special characters in Spanish and probably any other
language with special characters will come back with question marks. English submits fine though.

Firefox and Opera both encode the info correctly, so the server is
handling it ok and spitting it back out ok. Windows server.

One note, when I submit the Chinese using the entire page such as a normal form submittal (not
through the ajax call) ie sends it to the server correctly.

So from what I can gather, the ajax in ie is not encoding it
correctly or is double-encoding it for some reason. We have the
document header set to UTF-8. Ajax in ie seems to be ignoring it or
doubling-up on the encoding for some reason.

Do you have any possible suggestions on how to fix this problem?

Thank you for your time.

Comments

  • chief555chief555 Posts: 3Member
    I think I've figured it out...
    Have to use the encodeURI() function in javascript for the URL that is being called by the ajax function. This apparently encodes the field data into a usable format that can be passed via querystring to the server. Seems to work for Chinese, Spanish so I'll keep trying to see if I can break it with any other languages.

  • shadowman551shadowman551 Posts: 1Member
    : I think I've figured it out...
    : Have to use the encodeURI() function in javascript for the URL that is being called by the ajax function. This apparently encodes the field data into a usable format that can be passed via querystring to the server. Seems to work for Chinese, Spanish so I'll keep trying to see if I can break it with any other languages.
    :
    :
    I have similar problem ....Can you please paste some code to see how you've managed to overcome the problem...

    thank you
Sign In or Register to comment.