Skip to content

Error diffing tables containing UTF-8 characters #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cim-- opened this issue Mar 24, 2025 · 1 comment · May be fixed by #135
Open

Error diffing tables containing UTF-8 characters #134

cim-- opened this issue Mar 24, 2025 · 1 comment · May be fixed by #135

Comments

@cim--
Copy link

cim-- commented Mar 24, 2025

Version 0.1.16 fails with an iconv() error when trying to convert a table containing a UTF-8 character with no named html entity equivalent (so e.g. £ is fine but ■ will fail)
Version 0.1.15 works correctly.

Seems to be failing at line 630 of lib/Caxy/HtmlDiff/Table/TableDiff.php on the attempt to convert to iso-8859-1 encoding, possibly as a consequence of the changes for #123

Minimal reproduction

$t = "<table><tr><td>■</td></tr></table>"; 
$t2 = "<table><tr><td>■■</td></tr></table>";
$d = new Caxy\HtmlDiff\HtmlDiff($t, $t2); 
$d->build();

gives
iconv(): Detected an illegal character in input string in vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableDiff.php on line 630

Thanks

@jurgenhaas
Copy link

I'm running into the same issue. Adding the IGNORE option to the destination encoding in iconv resolves that. I'm opening a PR for this.

jurgenhaas added a commit to jurgenhaas/php-htmldiff that referenced this issue Apr 10, 2025
@jurgenhaas jurgenhaas linked a pull request Apr 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants