note 111948 deleted from class.domdocument by aharvey
| From: | aharvey@php.net | Date: | Tue, 16 Apr 2013 17:30:57 +0000 |
| Subject: | note 111948 deleted from class.domdocument by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194496@lists.php.net to get a copy of this message | ||
Note Submitter: mdessaintes at gmail dot com
----
Even if DomDocument should handle UTF-8, i can't get it work with. A solution to get the
correct characters into the DomDocument for any HTML source is :
mb_convert_encoding($source, 'HTML-ENTITIES', $sourceEncoding);
$sourceEncoding can depend on:
- HTTP header Content-Type
- HTML meta Content-Type
- HTML meta charset
- If nothing found, i hard code it using encoding found by the browser.
Output is UTF-8 encoded with all special characters encoded with HTML &xxx; syntax