Tag: utf8 decode

用Javascript解码UTF-8

我在一个传递UTF-8编码的string的XHTML网页中有Javascript。 它需要继续通过UTF-8版本,并解码它。 如何解码显示的UTF-8string? <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>