Masterminds / Masterminds/html5-php
Drupal Feeds throw error related to UTF8Utils.php encoding function
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 122
- PR merge metrics
- No merged PRs in 30d
Description
Drupal 9 website Drupal core 9.4.11 Web Server nginx/1.20.1. PHP Version 8.0.27 site composer.lock file references "masterminds/html5": "^2.7". The relevant modules are the feeds module and the feeds tamper module.
When attempting to restore txt file assets via the feeds module an error is thrown preventing any of the import file from running. The error will not occur if the .txt has no special characters or encoding. If \22238, or <93>brackets, etc are present the feed will fail and throw an error point to mb_convert_encoding. Around 10%-20% of the assets files in my import won't run and there is no message pointing to which records have the problems until you check individually.
Previously the feeds handled this code correctly, but at some point it stopped possibly related to php 8 or server changes.
Error Message
Message | ValueError: mb_convert_encoding(): Argument #3 ($from_encoding) must specify at least one encoding in mb_convert_encoding() (line 109 of /data/site/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php)#0 /data/site /vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php(109): mb_convert_encoding()
Line 109 UTF8Utils.php ( I think it's line 103 in the github repo)
$data = mb_convert_encoding($data, 'UTF-8', $encoding);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php around line 109 and reproduce the failure using a .txt import containing the reported special characters or brackets. Trace how the encoding value reaches mb_convert_encoding(), then verify that affected imports no longer fail and that the problematic records can be identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100