Giter VIP home page Giter VIP logo

Comments (2)

phil8900 avatar phil8900 commented on July 18, 2024

As this issue was preventing us from using helpy_imap effectively, I implemented a workaround for this problem which leaves room for improvement I guess.
Most emails we get are already encoded in UTF-8, but there are some that are in ISO 8859-1 which is in line with the numbers here: https://w3techs.com/technologies/history_overview/character_encoding. (92% UTF-8, 3,9% ISO 8859-1, for websites). Based on that I assume that there won't be a significant loss by misrepresented characters when we first convert ASCII-8BIT messages to ISO-8859-1 which is an extension for US ASCII. The downside might be that is not the most performant thing to do and therefore I would appreciate if someone has a smarter idea :)

from helpy_imap.

phil8900 avatar phil8900 commented on July 18, 2024

After some more testing I figured out that I made a mistake and that the proposed fix did not have the desired effect.
As I couldn't figure out why the "real" encoding of the @email variable does not represent the encoding of the raw email I came up with a different approach.
I added two checks if entity.force_encoding returns a String with valid encoding to distinguish UTF-8 and ISO-8859-X Strings, even if entity.encoding.name is just ASCII-8BIT which solved the problem for me.

from helpy_imap.

Related Issues (5)

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.