473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

AJAX and character

I have a simple AJAX script that sends and retrieves a text file. The
ajax function is called from index.html

....
var obj = document.getElementById(objID);

xmlHttp.open("GET", "testing.txt", true);
xmlHttp.onreadystatechange = function()
{
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.responseText;
}
}

xmlHttp.send(null);
....

The script works OK. I can see the 'testing.txt' file just fine. The
issue is that the file (testing.txt) contains spanish character like:
í, á

and i see this ? instead of those spanish characters.

This is my syntax in my index.html:
....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
....
What's wrong?

Is this a server issue? Coz' i'm hosting with Yahoo and i dont have
access to change the configuration of the server, obviously.

Please Help
sm

Feb 1 '07 #1
3 1398
Daz
On Feb 1, 8:01 pm, "servandomont...@gmail.com"
<servandomont...@gmail.comwrote:
I have a simple AJAX script that sends and retrieves a text file. The
ajax function is called from index.html

...
var obj = document.getElementById(objID);

xmlHttp.open("GET", "testing.txt", true);
xmlHttp.onreadystatechange = function()
{
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.responseText;
}
}

xmlHttp.send(null);
...

The script works OK. I can see the 'testing.txt' file just fine. The
issue is that the file (testing.txt) contains spanish character like:
í, á

and i see this ? instead of those spanish characters.

This is my syntax in my index.html:
...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
...

What's wrong?

Is this a server issue? Coz' i'm hosting with Yahoo and i dont have
access to change the configuration of the server, obviously.

Please Help
sm

The problem is that the server is not setting the header for the
returned data, so it's not processed correctly when it gets to the
client.

THis article should help you figure out how to solve the problem:
http://www.taylanpince.com/blog/AJAX...r-Support.html

Feb 1 '07 #2
SM
Thanks Daz for your answer. Basically what your saying is to use PHP
script instead of a txt file. Got it!
I will try it.

Thanks
sm

On Feb 1, 3:14 pm, "Daz" <cutenfu...@gmail.comwrote:
On Feb 1, 8:01 pm, "servandomont...@gmail.com"

<servandomont...@gmail.comwrote:
I have a simple AJAX script that sends and retrieves a text file. The
ajax function is called from index.html
...
var obj = document.getElementById(objID);
xmlHttp.open("GET", "testing.txt", true);
xmlHttp.onreadystatechange = function()
{
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
...
The script works OK. I can see the 'testing.txt' file just fine. The
issue is that the file (testing.txt) contains spanish character like:
í, á
and i see this ? instead of those spanish characters.
This is my syntax in my index.html:
...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
...
What's wrong?
Is this a server issue? Coz' i'm hosting with Yahoo and i dont have
access to change the configuration of the server, obviously.
Please Help
sm

The problem is that the server is not setting the header for the
returned data, so it's not processed correctly when it gets to the
client.

THis article should help you figure out how to solve the problem:http://www.taylanpince.com/blog/AJAX...racter-Support....

Feb 1 '07 #3
Daz
On Feb 1, 8:50 pm, "SM" <servandomont...@gmail.comwrote:
Thanks Daz for your answer. Basically what your saying is to use PHP
script instead of a txt file. Got it!
I will try it.

Thanks
sm

On Feb 1, 3:14 pm, "Daz" <cutenfu...@gmail.comwrote:
On Feb 1, 8:01 pm, "servandomont...@gmail.com"
<servandomont...@gmail.comwrote:
I have a simple AJAX script that sends and retrieves a text file. The
ajax function is called from index.html
...
var obj = document.getElementById(objID);
xmlHttp.open("GET", "testing.txt", true);
xmlHttp.onreadystatechange = function()
{
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
...
The script works OK. I can see the 'testing.txt' file just fine. The
issue is that the file (testing.txt) contains spanish character like:
í, á
and i see this ? instead of those spanish characters.
This is my syntax in my index.html:
...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
...
What's wrong?
Is this a server issue? Coz' i'm hosting with Yahoo and i dont have
access to change the configuration of the server, obviously.
Please Help
sm
The problem is that the server is not setting the header for the
returned data, so it's not processed correctly when it gets to the
client.
THis article should help you figure out how to solve the problem:http://www.taylanpince.com/blog/AJAX...racter-Support....
Not necessarily. I am just saying that you should use some kind of
script (be it ASP, PHP, Java, Perl, etc), to read the text file, and
set the header before sending it to the client.

Feb 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: GTi | last post by:
I have a ASP 2.0 page where I use some Ajax code. The Ajax code (JavaScript) is inserted from CodeBehind. In my page I have a submit button and some links for Ajax functions. When I load the page...
2
by: chuck | last post by:
Hi, Firstly, I don't know if this is just and isolated thing with the prototype.js library or is a problem in general with ajax calls with a '+' character, so i am posting it here. I am...
2
by: Seguros Catatumbo | last post by:
Hi, i am trying to fill a dropdown menu with ajax, but the table contains latin characters. In mozilla i get a weird black character instead, and in internet explorer the whole code breaks because...
4
by: Grant Merwitz | last post by:
Hi I am trying to implement the Microsoft Ajax.NET extensions to perform a lookup on a key press of a text box. What this will do is once a user enters a letter into the textbox, this will...
1
by: stepby | last post by:
Hi All, I have use the ajax with the server side language ASP. I find the when passing the parameter with the chinese character, the chinese character cannot show orderly and become "wrong code" ....
3
by: Tarik Monem | last post by:
Hi Everyone, Still a newbie with FLEX, and I've passed arrays using AJAX to FLEX before, but I've never passed links to FLEX. Basically, this is the OUTPUT, which I wanted, but I'm given an...
7
by: SV | last post by:
I am using ASP.Net / VB.Net v 2005. I want to add text recognition to one of the text box of suburb in my form. What I want to do is when user type any character in that text box, one dynamic list...
9
by: =?Utf-8?B?RGFuaWVs?= | last post by:
Hi, I downloaded the sample application that the Microsoft video ASPNETAJAXForWinMobile described but it doesn't work on my Windows Mobile 6 emulator. After enabling the script error reporting...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.