【发布时间】:2013-09-23 07:39:57
【问题描述】:
我必须将字符串编码为 UTF-8,以便正确显示德语变音符号。
我有以下 JavaScript:
.append( "<a><div class='autocompleteName'>" + itemLabel + " (" + item.id + ")</div></a>")
我需要将 itemLabel 变量编码为 UTF-8。
我需要能够在 JavaScript 中执行的这行 Java 代码:
itemLabel = new String(itemLabel.getBytes("ISO-8859-1"), "utf-8");
有人知道怎么做吗?
谢谢!
【问题讨论】:
标签: javascript encode