Hey all,
I am writing some code that is going to send a single AJAX request to run a
query, and the result would be used to populate 3 dropdown select elements.
Since the end result was going to be html, i thought of building the select
element entirely on the server and then return it and simply insert it into
the element using element.innerHTML. So my XML document was like so:
<?xml version="1.0" standalone="yes"?>
<info>
<userSelect>
htmlentities("<select name='user'><option
value='x'>X</option>...</select>");
</userSelect>
...
</info>
This worked just fine. But when the text of the option was in arabic,
parsing the XMl in javascript would simply halt and not give an error.
checking the headers showed that the response was containing some very weird
characters like so:
Ù�Ù�Ø
;¯Ù�Ø© Ù�Ù�
عÙ�Ù� اÙ
;�حاسÙ�Ø
.
Adding encoding="utf-8" to the xml header didn't help.
When i changed the xml document to like this:
<?xml version="1.0" standalone="yes"?>
<info>
<userSelect>
<user id="x">X</user>
<user id="y">Y</user>
...
</userSelect>
...
</info>
And then built the entire select on the client side, it worked perfectly
with arabic information.
I thought the problem might be with the htmlentities not understanding
arabic characters, so i did
iconv(mb_detect_encoding($select, "auto"), 'UTF-8', $select); But this
didn't help either.
I'm now using the latter technique in my work, but i was wondering why the
first one didn't work? is the problem with htmlentities like i guessed or is
something entirely different?
--
Al-Faisal El-Dajani
Phone: +962-7-77 799 781
P.O Box: 140056
11814 Amman, Jordan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Jordan PHP Users Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/JoPHP
http://Jolug.org/
-~----------~----~----~----~------~----~------~--~---