I have Javascript in an XHTML web page that is passing UTF-8 encoded strings.(我在传递UTF-8编码字符串的XHTML网页中有Javascript。)
It needs to continue to pass the UTF-8 version, as well as decode it.(它需要继续传递UTF-8版本,并对其进行解码。) How is it possible to decode a UTF-8 string for display?(如何解码UTF-8字符串以进行显示?)
<script type="text/javascript">
// <![CDATA[
function updateUser(usernameSent){
var usernameReceived = usernameSent; // Current value: Gr????????e
var usernameDecoded = usernameReceived; // Decode to: Gr??e
var html2id = '';
html2id += 'Encoded: ' + usernameReceived + '<br />Decoded: ' + usernameDecoded;
document.getElementById('userId').innerHTML = html2id;
}
// ]]>
</script>
ask by Jarrett Mattson translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…