# Other Programming > AJAX >  AJAX encoding problem

## life_maker

Hallo

i have encoding problem in AJAX , it seems that it doesnt support multilanguage , i m trying to display Arabic text and i got '????'

how can i solve this problem

----------


## gitter1226

I'm not quite sure what you're trying to say here.

AJAX in and of itself doesn't support anything.  It's just a design pattern that encompasses many technologies.  If you are using Client-Side and Server-Side languages you are familiar with nothing changes.  The only thing that changes when using AJAX is how requests are made to your server.

Can you be more specific as to your issue?

----------


## dmeikle

go into your html source code for the page.

look for a meta tag that says somthing like:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

iso-8859-1 is english. you will need to look up what the character set for Arabic is and simply replace the iso-8859-1 with the new value that will tell the browser to expect the new character set and display it accordingly.  this goes for all language types outside of normal browser expectations (chinese, japanese...)

----------


## maqsoodamd

> Hallo
> 
> i have encoding problem in AJAX , it seems that it doesnt support multilanguage , i m trying to display Arabic text and i got '????'
> 
> how can i solve this problem


 AJAX encoding problem 

can u fix it ajax encoding problem because i have same problem like you
if you have any solution please reply me at maqsoodamd@gmail.com

i m very thanks ful you in advance

----------


## PeejAvery

Welcome to the forums, maqsoodamd. Please note that the thread you posted on is over a year old and by a person who never came back to the forum. It is possible that you will not see a reply.  Whenever you have a problem, please create a new thread and explain your problem in detail. Thanks!

----------


## histool

Yes I too was held with the same problem , with ASP ans AJAX.
At last i found it

 I  added  the ASP code

<% response.Charset="windows-1256" %>

as the first line in the processing page which is requested  by XmlHttpRequestObject. 
Hope u got it. 

Good Luck

IHN




> AJAX encoding problem 
> 
> can u fix it ajax encoding problem because i have same problem like you
> if you have any solution please reply me at maqsoodamd@gmail.com
> 
> i m very thanks ful you in advance

----------


## nasirgulzade

Dear All,
Since I was having trouble with AJAX charset encoding today in the morning with refresh mind I found the solution, the reason why I am posting here is , I searched 2 whole days to find a solution from forums, etc but I could not. however now I am lucky to find the solution for any language just using utf-8 first let mi write my ajax
My Ajax code is like below:
not:you can save below code to a page like ajax_post.js



```
var xmlhttp_sp = false;

try {
//If the Javascript version is greater than 5.
xmlhttp_sp = new ActiveXObject(Msxml2.XMLHTTP);

} catch (e) {
//If not, then use the older active x object.
try {

xmlhttp_sp = new ActiveXObject(Microsoft.XMLHTTP);

} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp_sp = false;
}
}

if (!xmlhttp_sp && typeof XMLHttpRequest != undefined) {
xmlhttp_sp = new XMLHttpRequest();

}

function makerequest_sp(serverPage, params, objID)
{
var myRandom=parseInt(Math.random()*99999999);

params+=&+myRandom;

var url = serverPage;
//var params = lorem=ipsum&name=binny;
xmlhttp_sp.open(POST, url, true);
//Send the proper header information along with the request
xmlhttp_sp.setRequestHeader(Content-type, application/x-www-form-urlencoded; charset=UTF-8″);
xmlhttp_sp.setRequestHeader(Content-length, params.length);
xmlhttp_sp.setRequestHeader(Connection, close);
xmlhttp_sp.onreadystatechange = function() {//Call a function when the state changes.
if(xmlhttp_sp.readyState == 4 && xmlhttp_sp.status == 200) {
document.getElementById(objID).innerHTML = xmlhttp_sp.responseText;
//alert(xmlhttp_sp.responseText);
}
}
xmlhttp_sp.send(params); 

//xmlhttp_sp.send(null);
}
```

before I was using AJAX with GET method but when I GET form values in my language (farsi Afghanistan) it was just ???? and after using above ajax code I solved my problem.



```
//some comments
function makerequest_sp(serverPage, params, objID)
```

when you wanna call makerequest_sp it takes 3 params
1.serverPage like test.php
2.params the values of a form like name=nasir&id=34& 
3.objID is div id where you want to show xmlhttp_sp.responseText inside a div.

how you call this let me write a function how did I call



```
function test_dari(formid)
{
var formvalues = do_it(formid);
//this do_it function will retrieve all form name with its value
url=test.php;
var params=formvalues+action=getform&
makerequest_sp(url, params, mytest); //here is ajax call function
}
```

any help you want please write to me.
naser@netlinks.af

----------


## PeejAvery

Welcome to the forums, nasirgulzade.  :Wave: 

Please remember to keep your posts relevant. This thread is originally 3 years old.

----------

