Reputation: 1167
I have a percent encoded URI coming from an ajax result.
%F0%9F%91%9A%F0%9F%A7%9E%F0%9F%A4%B6%F0%9F%8F%BB%F0%9F%8E%85%F0%9F%8F%BC%F0%9F%91%9A%F0%9F%A7%9E
I would like to display the percent encoded URI in an html page
the encoded URI above is
ππ§π€Άπ»π
πΌππ§
But the display only shows the same percent encoded URI
The ajax request is done using jQuery
What function should I use to decode the percent encoded URI and display those emoji.
Upvotes: 0
Views: 415
Reputation: 15913
Use decodeURI
to decode your string and get the emoji's.
console.log(decodeURI('%F0%9F%91%9A%F0%9F%A7%9E%F0%9F%A4%B6%F0%9F%8F%BB%F0%9F%8E%85%F0%9F%8F%BC%F0%9F%91%9A%F0%9F%A7%9E'))
Upvotes: 1
Reputation: 1347
Jquery html works on setting up emoji. you need to decode your URI encoded string first.
$('#emoji').html(decodeURI('%F0%9F%91%9A%F0%9F%A7%9E%F0%9F%A4%B6%F0%9F%8F%BB%F0%9F%8E%85%F0%9F%8F%BC%F0%9F%91%9A%F0%9F%A7%9E'));
Upvotes: 1