html_entity_decode arabic chars to javacript var
Posted: Mon Jun 14, 2010 1:22 pm
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
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