473,625 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getEle mentById(objID) ;

xmlHttp.open("G ET", "testing.tx t", true);
xmlHttp.onready statechange = function()
{
if (xmlHttp.readyS tate == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.respons eText;
}
}

xmlHttp.send(nu ll);
....

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.dt d">
<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 1404
Daz
On Feb 1, 8:01 pm, "servandomont.. .@gmail.com"
<servandomont.. .@gmail.comwrot e:
I have a simple AJAX script that sends and retrieves a text file. The
ajax function is called from index.html

...
var obj = document.getEle mentById(objID) ;

xmlHttp.open("G ET", "testing.tx t", true);
xmlHttp.onready statechange = function()
{
if (xmlHttp.readyS tate == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.respons eText;
}
}

xmlHttp.send(nu ll);
...

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.dt d">
<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...@gma il.comwrote:
On Feb 1, 8:01 pm, "servandomont.. .@gmail.com"

<servandomont.. .@gmail.comwrot e:
I have a simple AJAX script that sends and retrieves a text file. The
ajax function is called from index.html
...
var obj = document.getEle mentById(objID) ;
xmlHttp.open("G ET", "testing.tx t", true);
xmlHttp.onready statechange = function()
{
if (xmlHttp.readyS tate == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.respons eText;
}
}
xmlHttp.send(nu ll);
...
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.dt d">
<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.comwrot e:
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...@gma il.comwrote:
On Feb 1, 8:01 pm, "servandomont.. .@gmail.com"
<servandomont.. .@gmail.comwrot e:
I have a simple AJAX script that sends and retrieves a text file. The
ajax function is called from index.html
...
var obj = document.getEle mentById(objID) ;
xmlHttp.open("G ET", "testing.tx t", true);
xmlHttp.onready statechange = function()
{
if (xmlHttp.readyS tate == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.respons eText;
}
}
xmlHttp.send(nu ll);
...
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.dt d">
<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
3007
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 and use the submit button it give me some results that is fine. Then I press the links that activate the Ajax Code the results is displayed fine on my page. - BUT - If I then press the submit button again I get this error: "The state...
2
4646
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 trying to send input from a form to do a live php boolean search. so an example search string is
2
2256
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 if a word ends in a latin character then it ignores the <bri put on the end, therefore affecting my data logic. I am using results = http.responseText.split("<br>"); as a delimiter. Is there a way to fix this without resorting to using xml...
4
8730
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 filter a list from a database and populate some filtered options for the user to choose in a seperate listbox. Any subsequent key presses will further filter this result set.
1
2426
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" . Anyone encounter this problem ? For the javascript coding function createRequest() {
3
3525
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 error of "illegal character," from the JavaScript console: Error: illegal character Source Code:
7
1955
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 appear under that text box having all suburb name start with that character. How do I achieve that? Any hints…… Any help will be appreciated. Thanks,
9
3711
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 of the mobile IE, it pops up several JScript error and the ajax behavior is not funtional at all. Where can I look for any possible issue? Thanks.
0
8251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.