Skip to content

Instantly share code, notes, and snippets.

@xeoncross
xeoncross / domdocument_encoding.php
Last active August 27, 2024 02:31
Fix HTML encoding errors with PHP DOMDocument
<?php
// Ignore errors
libxml_use_internal_errors(true) AND libxml_clear_errors();
// http://stackoverflow.com/q/10237238/99923
// http://stackoverflow.com/q/12034235/99923
// http://stackoverflow.com/q/8218230/99923
// original input (unknown encoding)