Comments (2)
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.
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
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 helpy_imap.