What s the right way to decode a string that has special HTML entities in it

0 votes

Let's say I submit a service request and receive the following JSON response:

{
    "message": "We're unable to complete your request at this time."
}

All I know is that I want to decode that apostrophe; I have no idea why it is encoded that way (&#39').

Here is a jQuery-based method that sprang to mind:

function decodeHtml(html) {
    return $('<div>').html(html).text();
}

But that looks (very) clumsy. What might work better? Exists a "correct" approach?

Jul 8, 2022 in HTML by Tejashwini
• 3,820 points
504 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In HTML

0 votes
0 answers

horizontal line and right way to code it in html, css

I need to draw a horizontal line ...READ MORE

Aug 19, 2022 in HTML by Tejashwini
• 780 points
572 views
0 votes
0 answers

How to get the entire document HTML as a string?

Is there a way in javascript to ...READ MORE

Jun 3, 2022 in HTML by Tejashwini
• 3,820 points
472 views
0 votes
0 answers

how to create a HTML5 video element without it being shown in the page?

how is it possible to dynamically create ...READ MORE

Jul 5, 2022 in HTML by Tejashwini
• 3,820 points
475 views
0 votes
0 answers

How to re-enable right click so that I can inspect HTML elements in Chrome?

I am currently seeing a web page ...READ MORE

Jul 21, 2022 in HTML by Ashwini
• 5,430 points
705 views
0 votes
0 answers

Get the query string value and display it in my html page

I can see the query string values ...READ MORE

Jul 21, 2022 in HTML by Ashwini
• 5,430 points
1,774 views
0 votes
0 answers

when I click the right button in my slider it moves right, but after once moving right its neither moves right nor left

Views.py File def index(request): allProds ...READ MORE

Oct 25, 2020 in HTML by Dhruvil
• 120 points
1,055 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,520 points
1,323 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
15,717 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
23,302 views
0 votes
1 answer

How to make Bootstrap popover Appear/Disappear on hover instead of click?

Hello @kartik, Set the trigger option of the popover to hover instead ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,840 points
3,316 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP