2010-08-09 92 views
2

此代码的工作非常好:jQuery的阿拉伯字母支持

的Html

<html><body> 
<div id="container"></div> 
</body></html> 

jQuery的

$('<div id="footer"><p>جميع الحقوق محفوظه لشركة</p></div>').insertAfter('#container'); 

但在阿拉伯字母的问题,它看起来像:

������������������������ 
+0

可能重复的[在HTML中显示unicode符号](http://stackoverflow.com/questions/1696619/displaying-unicode-symbols-in-html ) – 2010-08-09 19:25:35

+0

这是一个字符集问题:你需要让你的编码正确。良好的基本阅读:http://www.joelonsoftware.com/articles/Unicode.html – 2010-08-09 19:26:32

回答

4

您应该指定在您的网页上进行编码以解决此类问题。下面是来自W3C的一个页面上指定的字符编码:

http://www.w3.org/TR/html4/charset.html#h-5.2.2

你应该罚款使用UTF-8,你可以通过添加如下代码,请<head>标签注明:

<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
+0

对,对你的回答评论的人也是绝对正确的。 :) – Faisal 2010-08-09 19:27:50

+0

以上试过这是这个结果 افرئسةافإشترا اتصفبلااف رنغ – 2010-08-09 19:50:40

+0

工作与科尔多瓦以及,谢谢。 – 2014-01-09 11:22:03

0

尝试使用escape():

$('<div id="footer"><p>'+escape('جميع الحقوق محفوظه لشركة')+'</p></div>').insertAfter('#container');