Giter Club home page Giter Club logo

Comments (6)

soundasleep avatar soundasleep commented on July 26, 2024

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.

ulrichsg avatar ulrichsg commented on July 26, 2024

Sure thing :)

from html2text.

jigante avatar jigante commented on July 26, 2024

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.

soundasleep avatar soundasleep commented on July 26, 2024

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.

jigante avatar jigante commented on July 26, 2024

The new commit in the non-breaking-space branch solves the problem for my use cases

from html2text.

soundasleep avatar soundasleep commented on July 26, 2024

Resolved with PR #32 and released as 0.3.1

from html2text.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.