Skip to content

Commit 902fcc6

Browse files
committed
docs: add comment
1 parent 9b2e414 commit 902fcc6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

system/Test/DOMParser.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ public function getBody(): string
6161
*/
6262
public function withString(string $content)
6363
{
64-
// encode character to HTML numeric string reference
64+
// DOMDocument::loadHTML() will treat your string as being in ISO-8859-1
65+
// (the HTTP/1.1 default character set) unless you tell it otherwise.
66+
// https://stackoverflow.com/a/8218649
67+
// So encode characters to HTML numeric string references.
6568
$content = mb_encode_numericentity($content, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8');
6669

6770
// turning off some errors

0 commit comments

Comments
 (0)