- With the function decodeURIComponent in JavaScript
Decoding this
%E2%80%9C
will get the following
“
<script type="text/javascript">
function decode() {
var obj = document.getElementById('dencoder');
var encoded = obj.value;
obj.value = decodeURIComponent(encoded.replace(/\\+/g, " "));
}
</script>
<textarea cols="80" rows="20" id="dencoder"></textarea>
<div>
<input type="button" onclick="decode()" value="Decode">
</div>
Working!
- PHP not working
However, I am not able to decode it in PHP.
Already tried…
echo ord(utf8_decode(urldecode("%E2%80%9D")));
echo "<br>";
echo ord(urldecode("%E2%80%9D"));
echo "<br>";
// not getting this value
echo ord('“');
Any idea to decode %E2%80%9D in php and get this char “ ?