JSFiddle - React, Tailwind, and code Playground

by Abhishek Kumar

HTML

<div id="konsole"></div>

JavaScript

function utf2html(text) {
    var tohtml = function(token) {
    	return '&#x'; 
    }
	return text.replace(/((\\u)|(U\+))(?=\d{4})/g, tohtml);
}

var teststr = '<p>abhi\u2019s ipod</p>\n<p>raviU+0027s ipod</p>';
var konsole = document.getElementById('konsole');
konsole.innerHTML = utf2html(teststr);