我的标题里有这个
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
这在我的 htaccess 中:
# UTF-8 encoding
# ----------------------------------------------------------------------
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8
# Force UTF-8 for a number of file formats
AddCharset utf-8 .css .js .xml .json .rss .atom
我的浏览器是谷歌浏览器。 当我在 html 中使用 javascript 变量作为输出时,“ä”变为“ä”?
最佳答案
您应该在 <script>
中设置正确的字符集包含您的文件的标记或将纯 ASCII 范围之外的所有符号编码为 unicode 实体 -\xNNNN,从而使文件字符集中性。一些压缩器(例如 Google Closure Compiler)可以为您完成此操作。
关于javascript - 用 javascript 写变音符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10834443/