cure53 / DOMPurify

DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:
https://cure53.de/purify
Other
13.61k stars 695 forks source link

Using DOMPurify to render unicode values properly #892

Closed bhansa closed 8 months ago

bhansa commented 8 months ago

This issue proposes a [bug, feature] which...

Background & Context

I have data coming from an api and I am wondering if I can use DOMPurify to render the unicode values properly.

Input

\n

We\u00e2\u0080\u0099re looking for a Customer Success Manager, Scale to join our team of humble \u00e2\u0080\u009cmisfits that fit\u00e2\u0080\u009d. 

Given output

The output given by DOMPurify.

Expected output

I am expecting the output will remove or render Unicode values properly.

Let me know the best way to do this.

Supporting stackoverflow question: https://stackoverflow.com/questions/77738308/render-unicodes-in-react-using-dangerously-set-innerhtml

cure53 commented 8 months ago

Hey there, I am not sure if this is a problem our library aims to tackle. DOMPurify is here to prevent XSS. Can you elaborate how you would see this as something we can fix?

bhansa commented 8 months ago

Hi, this may not be directly related to the library but I was wondering if there is any solution to resolve this issue. Hence I found DOMPurify as a option on lot of websites to clean the DOM and render it. I thought of asking it here.

Let me know if that's a fair understnading.

cure53 commented 8 months ago

I think this is way outside the scope if what we offer, sorry :slightly_smiling_face: