I must encode a String to UTF-8, in order that the German Umlaut to be correctly displayed.
I have the following JavaScript:
.append( "<a><div class='autocompleteName'>" + itemLabel + " (" + item.id + ")</div></a>")
I need to encode itemLabel variable to UTF-8.
This Java line of code I need to be able to execute in JavaScript:
itemLabel = new String(itemLabel.getBytes("ISO-8859-1"), "utf-8");
Does anyone know how?
Thank you!
I found this on http://www.w3schools.com/tags/att_script_charset.asp
set your script tag as
<script src="myscripts.js" charset="UTF-8"></script>
maybe it works
如何将此元标记放在html文件的开头。
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.