Comments (6)
This definitely sounds like sadness, some weird interaction between UTF-8 and str_replace. Maybe there needs to be some utf8_encode()/utf8_decode(), maybe there needs to be some iconv/mbstring, maybe html2text simply can't support this... What was the hex output of html2text 0.2.3 on the same input?
Can you create a pull request with a new test (in tests/), both with the before and expected after text encoded as UTF-8, and we can go from there?
from html2text.
Sure thing :)
from html2text.
I have the same problem. All the content that was converted correctly before the upgrade from 0.2.3 to 0.3.0 now brings question marks characters, not recognized as UTF8, breaking the output.
Removing the line
$html = str_replace("\xa0", " ", $html);
from "Html2Text" class resolves the problem
from html2text.
Can you all check out the new non-breaking-space
branch and see if this resolves the issue for your tests? (PHP + character encodings = much sadness!)
If so, I'll merge into master
and release 0.3.1 right away. If not, can you please contribute more pull requests off this branch, with additional tests?
Thank you @ulrichsg for the test contribution!
from html2text.
The new commit in the non-breaking-space
branch solves the problem for my use cases
from html2text.
Resolved with PR #32 and released as 0.3.1
from html2text.
Related Issues (20)
- PHP 8.2 Support HOT 1
- mb_convert_encoding is DEPRECATED in php 8.2 HOT 2
- MIT License HOT 3
- Support RTL
- New release HOT 3
- Using < character as input to html2text HOT 5
- Strip zero width non joiners HOT 1
- Causes failure with AWS SES when sending RAW email with attachments HOT 6
- Minimal version of PHP ? HOT 1
- random DOMDocument::loadHTML() error HOT 3
- Incorrect operation of the drop_links option
- Problem decoding certain unicode representations HOT 1
- Leaves ampersand in href
- ErrorException: Required parameter $options follows optional parameter $prevName HOT 2
- 💀 Dead project? HOT 5
- Looking for maintainer HOT 12
- Ability to change number of new lines in output HOT 1
- Links without text should be discarded
- PHP8.1, Deprecated: Optional parameter $prevName declared before required parameter $options HOT 2
- error for correct url with multiple get params
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html2text.