url encoding - How to decode url-encoded string in javascript -


i use javascript / jquery fill dom elements contain umlauts:

var text1 = "unser platonisches internetreich droht in die h%e4nde einer bewaffneten miliz zu fallen."  $("#quote1 span").html(unescape(text1)); 

how can rid of url encoding e.g. "h%e4nde" , use "hände" instead? tried

<meta charset="utf-8" />  <meta name="http-equiv" content="content-type: text/html; charset=utf-8"/>  <script type="text/javascript" src="js/index.js" charset="utf-8"></script> 

but none of them seem work...

thanks help.

that not utf-8, percent encoding known url encoding.

you can use decodeuricomponent() convert before displaying it

$("#quote1 span").html(decodeuricomponent(text1));


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -