Comments (5)
I suspect that OpenPop assumes US-ASCII as encoding, since no encoding is specified in the Content-Type. OpenPop does not try to guess the encoding if not specifies, it defaults to US-ASCII. Not sure if this is specified in an RFC anywhere.
Most XML documents are UTF, and it also says so in the first line. However, OpenPop does not inspect the contents of an attachment, but only looks at the MIME headers. If this is general for your application, you could decode the bytes to a string yourself, using the correct encoding.
from hpop.
This can fixed by changing in MessagePrt.cs GetBodyAsText() method to
public string GetBodyAsText()
{
return Encoding.UTF8.GetString(Body);
// Original gets ?? characters instead of unicode ones
//return BodyEncoding.GetString(Body);
}
How to change OpenPop so this can used without changing source code ?
from hpop.
Your changes would destroy any attachment which does not use UTF-8. Instead, you should convert the raw bytes yourself:
MessagePart m = ...; // Get the message part somehow
string text = Encoding.UTF8.GetString(m.Body);
In that way, you do not have to change OpenPop.
from hpop.
Shoud line in sample code
var xml = ado.GetBodyAsText();
changed to
var xml = Encoding.UTF8.GetString(ado.Body);
?
from hpop.
Yes
from hpop.
Related Issues (20)
- OpenPop.Mime.Message.ToMailMessage() - Wrong HTML-Body conversion HOT 1
- embedded PDF linked to iCloud file HOT 3
- Pop3Client.Connect(stream) hangs forever. HOT 1
- I am not getting my updated email from gmail
- Pop3Client.IsOkResponse throws exception on successful authentication HOT 2
- Content Location support HOT 1
- Using POP3 vs IMAP HOT 1
- How i can mark mail has read? HOT 2
- OpenPop.Mime.Message HOT 1
- connection failes pop.ionos.com HOT 1
- Null Pointer Exception when authentication fails
- .NET Standard 2.x or .NET Core 3.x HOT 1
- How to detect attachments in 7bit
- Connecting to POP3 server using IPv6 fails
- Not able to read already read emails HOT 1
- Authentication failed because the remote party has closed the transport stream
- Exception during GetMessage (unusual UTF-8-Base64 content-type)
- Mails get not deleted after QUIT
- 'ANSI_X3' is not a supported encoding name. For information on defining a custom encoding.
- Oauth2 not supported. HOT 3
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 hpop.