I have an expression in angularjs to replace special character Registered with surrounding sup tags.
replace(/®/gi, '<sup>®</sup>')
But in the developer tools, it is changing the ® to a symbol (a question mark symbol)
.replace(/�/gi, '<sup>®</sup>');
Not sure if the issue is with the angularjs header content-type. Please help!
Thanks.
Use .replace(/\®/gi, '<sup>®</sup>')
Because \®
= ®
For more information,
var x = "\®" var y = x.replace(/\®/gi, '<sup>®</sup>') console.log("x=",x); console.log("y=",y); var x1 = '®'; var y1 = x.replace(/\®/gi, '<sup>®</sup>') console.log("x1=",x1); console.log("x1= Ox00%s",x1.charCodeAt(0).toString(16)); console.log("y1=",y1);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.