Categories
Dev

PHP Encoding issues

Had an issue we were running into regarding encoding while trying to render content that had been parsed by DOMDocument()

utf 8 – Getting ’ instead of an apostrophe(') in PHP – Stack Overflow

Solution:
echo mb_convert_encoding($content,"HTML-ENTITIES","UTF-8");

mb_convert_encoding is your friend 🙂