Problem/Motivation

We utilize a htmlspecialchars_decode(iconv()) which helps encode our text, however there are certain edge cases where:

$dom->loadHTML(htmlspecialchars_decode(iconv('UTF-8', 'ISO-8859-1', htmlentities($text, ENT_COMPAT, 'UTF-8')), ENT_QUOTES));

could result in data loss if there are encoding mismatches when using functions like iconv.

Proposed resolution

It looks like for PHP 8.2 the accepted solution for this is leveraging:

$dom->loadHTML(mb_encode_numericentity($text, [0x80, 0x10FFFF, 0, ~0], 'UTF-8'));

Let's switch it to use that instead.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

j-barnes created an issue. See original summary.

j-barnes’s picture

Status: Active » Needs review

  • j-barnes committed ceb639a9 on 1.0.x
    Issue #3461795: Refactor Text Processing to Use mb_encode_numericentity...
j-barnes’s picture

j-barnes’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.