I want to decode the chinese characters into the input text field.But it is showing the field as it is.
But it is showing the "漢 ;字 ;" instead of chinese characters
Expected output :漢字
output :漢 ;字 ;
it is working fine when i use textarea
input type="text" id="chinese"
function myFunction() {
var uri_dec = decodeURIComponent("漢字")
document.getElementById("chinese").value= uri_dec;
}
Please help me on this
Thanks in advance
decodeURIComponent
doesn't do what you think it does. It will decode"%E6%BC%A2%E5%AD%97"
(an URI-encoded string) into"漢字"
; but you have HTML entities, not an URI-encoded string.