Comments (3)
Why would you expect the correct encoding?
Your email doesn't have the conten-type header with no charset define?
Have you tried actually testing which charset is detected by the library and to which it tries to convert the content?
If you specify actually on your sample the utf-8 charset and the and the header, the parsing works
https://play.golang.com/p/M6A0RlQx_oE
from enmime.
Pedro is right, correctly encoded mail should contain charset encoding headers.
Enmime does attempt to use the chardet library to figure out character sets when possible:
Line 180 in ebd4cb3
It may not have enough information to detect correctly here.
from enmime.
Thank you both, I think you have actually answered my question here - I just found https://www.w3.org/Protocols/rfc1341/7_1_Text.html which states The default Content-Type for Internet mail is "text/plain; charset=us-ascii"
(I assumed this was UTF8). Sorry for the "issue", I'll mark this as resolved, thanks again :)
from enmime.
Related Issues (20)
- golangci workflow broken
- Delivery Status Notification parsing (bounce messages) HOT 1
- TestReadHeader/equals_in_name fails on Go1.20 HOT 3
- Export coding package? HOT 1
- Bug in validHeaderFieldByte(): characters disallowed in http header field are allowed in email header field HOT 7
- Any plan to tag a new version? HOT 1
- Attachment not detected HOT 3
- Breaking change: do not modify header case? HOT 2
- Request: Additional case-normalizing before passing into mime.ParseMediaType
- Type of the `(*enmime.Part).Header` field is now private HOT 3
- BCC addresses are not added HOT 5
- Use `errors.Is()` and `errors.As()` to compare error values and types
- EML Attactment Issue
- Parser can loose the original content format
- Failing to find attachments for emails sent by apple mail HOT 2
- ReadPartErrorPolicy not called for part content with malformed base64
- Update golangci-lint linters config
- BUG: GetHeader() doesn't add quote for especials
- Declared header character encoding cannot always be trusted HOT 1
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 enmime.