Working in IE 10 (including back to IE7 mode): http://jsfiddle.net/FersM/2/
Try this:
function myfun()
{
var a = "'\\u0c39";
a = a.replace(/\\u([a-f0-9]{4})/gi, function (n, hex) {
return String.fromCharCode(parseInt(hex, 16));
});
alert(a);
}
If you want to understand it, the regular expression is looking for all instances of a backslash (double-escaping needed within a regex literal) followed by exactly 4 hexadecimal digits (of whatever case), and then the function will replace the contents of each sequence thus found with the return value. The return value uses fromCharCode to convert a Unicode "code point" value into the actual character, but it requires the code point as a number (decimal), so we must first convert the 4 hex characters (the first parenthetical match, and thus the 2nd argument of the function, with the first argument being the whole sequence match which we don't need) into a decimal using the parseInt function with the base argument as "16".