soundasleep / html2text

A PHP component to convert HTML into a plain text format
MIT License
475 stars 135 forks source link

Php 8.2 Support #101

Closed phpfui closed 1 year ago

phpfui commented 1 year ago

PHP 8.2 depreciated mb_convert_encoding($html, "HTML-ENTITIES", "UTF-8"); The solution was to correctly specify the character set when loading the DOM. Unfortunately, that only works on PHP 8.1 and higher, probably due to some bug that was fixed. So I detect PHP 8.0 and lower and use the previous logic. Not pretty, but it works.

I also modernized the package with the following improvements:

ToDo:

edgrosvenor commented 1 year ago

@phpfui Thank you! This looks great. I'll get this merged in and get a release out over the holiday break.

phpfui commented 1 year ago

Ed,

Hope you had a good XMas weekend. Any chance you could merge and publish a release? I have three PR's for 8.2 compatibility. One merged, two to go, and you can make it one to go!

This is a well thought out package and would love to see it continue.

Thanks.

phpfui commented 1 year ago

@edgrosvenor any chance we can get this merged and a new release published? The PR looks like a lot of changes, but most are just housekeeping / cleanup. Let me know if you have any questions / issues.

edgrosvenor commented 1 year ago

@phpfui All set. Thank you!