Arabic characters doesn't show properly in JavaScript -


when add arabic characters in javascript, not showed properly. guess ascii problem. suggestions?

javascript

document.getelementbyid('div-msg').innertext = "اسم المستخدم لا يمكن أن تترك فارغة"; 

html

<html> <head>  </head> <body>     <div id="div-msg" style="width:100%; height:200px; background:yellow">      </div>     <script type="text/javascript">         document.getelementbyid('div-msg').innertext = "اسم المستخدم لا يمكن أن تترك فارغة";     </script> </body>  </html> 

i have met issue when tried write turkish characters. solution simple.

  • first, move javascript code external script file.
  • second, add script html charset attribute below

    <script src="external_script.js" charset="utf-8" type="text/javascript"></script> 

Comments

Popular posts from this blog

PHP while loop dynamic rowspan -

timer - Java TimerTask cancel -

android - How to read a column value in parse.com without accessing an object or a pointer -