Skip to content

Commit 89c7dda

Browse files
authored
Merge pull request #272 from jtojnar/wip/jtojnar/mbstring-depr
unicodeToHtmlEntities: Fix PHP 8.2 deprecation
2 parents 2bbcf26 + 180839b commit 89c7dda

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Mf2/Parser.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ function fetch($url, $convertClassic = true, &$curlInfo=null) {
9393
* @return string
9494
*/
9595
function unicodeToHtmlEntities($input) {
96-
return mb_convert_encoding($input, 'HTML-ENTITIES', mb_detect_encoding($input));
96+
// Convert all non-ASCII characters to HTML numeric entities.
97+
$convmap = [
98+
0x80, 0x1FFFFF, 0, 0x10FFFF,
99+
];
100+
101+
return mb_encode_numericentity($input, $convmap, mb_detect_encoding($input), true);
97102
}
98103

99104
/**

0 commit comments

Comments
 (0)