[PHP] Problem with special characters - PHP & AJAX

This is a discussion on [PHP] Problem with special characters - PHP & AJAX within the PHP General forums, part of the PHP Programming Forums category; Hi all, I'm writing a simple dictionary with php and ajax. It works perfects with firefox but not in ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-07-2008
bperquku
 
Posts: n/a
Default [PHP] Problem with special characters - PHP & AJAX


Hi all,

I'm writing a simple dictionary with php and ajax. It works perfects with
firefox but not in IE.
Here is the link

http://kllapa.com/fjahalori/test.html

I used alerts in js and find out that in the following function:

function updateMsgOnBrowser(testXML) {

var test = testXML.getElementsByTagName("test")[0];
var message=new Array(20);
var m = new Array(20);
var td = new Array(20);
var i;
for (i=1;i<=10;i++){
message[i]=testXML.getElementsByTagName("message"+i)[0];
message[i+1]=testXML.getElementsByTagName("message"+i+"r")[0];
if (message[i]!=null){m[i] = message[i].firstChild.nodeValue;}
else{m[i]=""}
if (message[i+1]!=null){m[i+1] = message[i+1].firstChild.nodeValue;}
else{m[i+1]=""}
td[i]= document.getElementById("td"+i);
td[i+1]= document.getElementById("td"+i+"r");
td[i].innerHTML=""+m[i];
td[i+1].innerHTML=""+m[i+1];
}
}

the line

message[i]=testXML.getElementsByTagName("message"+i)[0];

becomes null in IE when tag message contains special character (ë, ç, Ë, Ç,
etc.). Why this works perfect in Firefox?

Any idea what could be the issue??


Thanks in advance
--
View this message in context: http://www.nabble.com/Problem-with-s...p18311031.html
Sent from the PHP - General mailing list archive at Nabble.com.

Reply With Quote
  #2 (permalink)  
Old 07-07-2008
Michael Kubler
 
Posts: n/a
Default Re: [PHP] Problem with special characters - PHP & AJAX

Are the messages being sent as UTF-8 or something else? Is the server
sending the headers as something different to that listed in the header?
Actually, looking at it, you don't have a valid DOC-TYPE
<http://validator.w3.org/check?uri=http%3A%2F%2Fkllapa.com%2Ffjahalori%2Fte st.html&charset=%28detect+automatically%29&doctype =Inline&group=0>,
nor character Encoding set.

It might be something else, but I haven't played with enough AJAX to
debug the javascript.

Michael Kubler
*G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>



bperquku wrote:
> Hi all,
>
> I'm writing a simple dictionary with php and ajax. It works perfects with
> firefox but not in IE.
> Here is the link
>
> http://kllapa.com/fjahalori/test.html
>
> I used alerts in js and find out that in the following function:
>
> function updateMsgOnBrowser(testXML) {
>
> var test = testXML.getElementsByTagName("test")[0];
> var message=new Array(20);
> var m = new Array(20);
> var td = new Array(20);
> var i;
> for (i=1;i<=10;i++){
> message[i]=testXML.getElementsByTagName("message"+i)[0];
> message[i+1]=testXML.getElementsByTagName("message"+i+"r")[0];
> if (message[i]!=null){m[i] = message[i].firstChild.nodeValue;}
> else{m[i]=""}
> if (message[i+1]!=null){m[i+1] = message[i+1].firstChild.nodeValue;}
> else{m[i+1]=""}
> td[i]= document.getElementById("td"+i);
> td[i+1]= document.getElementById("td"+i+"r");
> td[i].innerHTML=""+m[i];
> td[i+1].innerHTML=""+m[i+1];
> }
> }
>
> the line
>
> message[i]=testXML.getElementsByTagName("message"+i)[0];
>
> becomes null in IE when tag message contains special character (ë, ç, Ë, Ç,
> etc.). Why this works perfect in Firefox?
>
> Any idea what could be the issue??
>
>
> Thanks in advance
>


Reply With Quote
  #3 (permalink)  
Old 07-07-2008
Jason Norwood-Young
 
Posts: n/a
Default Re: [PHP] Problem with special characters - PHP & AJAX


On Mon, 2008-07-07 at 19:35 +0930, Michael Kubler wrote:
> Are the messages being sent as UTF-8 or something else? Is the server
> sending the headers as something different to that listed in the header?
> Actually, looking at it, you don't have a valid DOC-TYPE
> <http://validator.w3.org/check?uri=http%3A%2F%2Fkllapa.com%2Ffjahalori%2Fte st.html&charset=%28detect+automatically%29&doctype =Inline&group=0>,
> nor character Encoding set.


Yeah you might want to check out HTML Entities
(http://www.php.net/manual/en/function.htmlentities.php) - great help in
encoding. Then set a doc type too.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:23 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0