JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 9th, 2008, 12:02 PM
vasilanthropos vasilanthropos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 145 vasilanthropos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 2 h 47 m 24 sec
Reputation Power: 3
Ajax script encoding problem

Hello. I have the following problem. I have an ajax script that calls a php page. The problem is that results that appear in my page that calls the ajax script is that the greek characters are not shown properly (instead i get some ??). The php page that i call with ajax if i called it directly i can see it in the correct way. I think that the problem is in ajax.

I do sth like the following

http.open("GET", myurl+"&rand="+myRand, true);
//i believe that http must have an attribute for specific encoding but i cannot find which
http.onreadystatechange = useHttp5;
http.send(null);




function useHttp5() {
if (http.readyState == 4) {
if(http.status == 200) {
var mytext = http.responseText;
//if i alert here mytext, it has wrong encoding
document.getElementById('choices').innerHTML = mytext;
document. getElementById('Dresults').innerHTML = "";
}
} else {

document. getElementById('choices').innerHTML = "";
document. getElementById('Dresults').innerHTML = "";
}
}


Thanks

Reply With Quote
  #2  
Old May 9th, 2008, 02:18 PM
vbrtrmn's Avatar
vbrtrmn vbrtrmn is offline
I <3 Javascript
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2004
Location: Northern Virginia
Posts: 1,775 vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level)vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level)vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level)vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level)vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level)vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level)vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level)vbrtrmn User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 6 Days 21 h 39 sec
Reputation Power: 139
Send a message via ICQ to vbrtrmn Send a message via AIM to vbrtrmn Send a message via MSN to vbrtrmn Send a message via Yahoo to vbrtrmn
First, you're not a noob, use CODE tags!

Make sure the back-end script is providing UTF-8 characters and the browser is set to display UTF-8 characters.

HTML meta tag
Code:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

PHP header()
Code:
header('Content-type: text/html; charset="utf-8"',true);


Consider using htmlentities.
__________________
------------- vbrtrmn --------------
i think i'm missing some vowels here
------------------------------------
---------- js.antinoc.net ----------
------------------------------------
--- The Two Types of Programmers ---

Reply With Quote
  #3  
Old May 10th, 2008, 09:40 AM
vasilanthropos vasilanthropos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 145 vasilanthropos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 2 h 47 m 24 sec
Reputation Power: 3
Thanks. Problem solved. I had in my php script only the meta tag and not the header. It is ok now!

Last edited by vasilanthropos : May 10th, 2008 at 09:49 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Ajax script encoding problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway