This is possibly an odd query,
As part of a JavaScript component on a page, I am displaying the titles of several blog posts pulled from WordPress. The WP site is maintained by a marketing team. Occasionally they use characters in the title which render fine on the WP site but in the process of scraping are encoded (& ' and - in particular). Although the data is coming from a trusted source we need to maintain some form of encoding to help prevent XSS however we would also like to see these characters rendered correctly. The JavaScript function decodeURIComponent() renders the characters fine but unfortunately leaves us open from a security perspective.
Has anyone encountered this sort of issue before? Any suggestions for libraries or approaches to get around this would be greatly appreciated.
An example of the sort of input we need to work with is as follows:
NN – Web – Site – Test Article & stuff ’ & –