Hi everyone,
I hope someone here will be able to help me out with this.
I have some Arabic text stored in PHP as follows:
$JScriptMotVide = '«من فضلك اكتب كلمة رئيسية»';
If I output this variable in html it displays perfectly in Arabic: «من فضلك اكتب كلمة رئيسية»
The problem is when this string is used in a javascript pop-up. It is passed to the javascript variable using html_entity_decode:
<script type="text/javascript">
var emptyStr = "<?php echo html_entity_decode($JScriptMotVide, ENT_QUOTES, 'UTF-8' ) ?>";
</script>
When the text is displayed in the pop-up, it shows as seen in the attached image - sort of Arabic, with some other weird characters in there...
If anyone has experienced similar problems and has any suggestions please let me know.
cyan
html_entity_decode arabic chars to javacript var
Moderator: General Moderators
html_entity_decode arabic chars to javacript var
- Attachments
-
- javascript pop-up text
- bad-arabic.png (3.18 KiB) Viewed 328 times
-
Phoenixheart
- Forum Contributor
- Posts: 123
- Joined: Tue Nov 16, 2004 7:46 am
- Contact:
Re: html_entity_decode arabic chars to javacript var
Does the text appear correctly in the HTML source?
Re: html_entity_decode arabic chars to javacript var
Hi,
What I see in the HTML source is this, which is the correct arabic characters:
var emptyStr = "«من فضلك اكتب كلمة رئيسية»";
Thanks for any suggestions,
cyan
What I see in the HTML source is this, which is the correct arabic characters:
var emptyStr = "«من فضلك اكتب كلمة رئيسية»";
Thanks for any suggestions,
cyan
Re: html_entity_decode arabic chars to javacript var
i guess that means this is actually a javascript problem then,
i'll try looking for some help on their forums.
i'll try looking for some help on their forums.