Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1200

Decode UTF-8 with Javascript

$
0
0

I have Javascript in an XHTML web page that is passing UTF-8 encoded strings. It needs to continue to pass the UTF-8 version, as well as decode it. How is it possible to decode a UTF-8 string for display?

<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>

Viewing all articles
Browse latest Browse all 1200

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>