Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding for getBodyHtml is always UTF8? #515

Open
jahrralf opened this issue Aug 9, 2021 · 0 comments
Open

Encoding for getBodyHtml is always UTF8? #515

jahrralf opened this issue Aug 9, 2021 · 0 comments
Labels

Comments

@jahrralf
Copy link

jahrralf commented Aug 9, 2021

Q A
ddeboer/imap version 1.12.1
PHP version 7.4
IMAP provider netcup.net

Summary

getBodyHtml always returns UTF8, parsing this HTML will lead to errors because the HTML meta tags indicate a different encoding and this is followed by DOMDocument, e.g.. This leads to broken umlauts.

Current behavior

When I load the html body of a message, it is always encoded/transcoded to UTF8 although the message part is in a different encoding. This is an issue because HTML also has information about the encoding and this does not get changed by ddeboer/imap. When this string is then processed by DOMDocument it leads to trouble with umlauts because DOMDocument observes the meta tags in the html which still show the original encoding, saving it then leads to double-encoding (because the UTF8 chars are saved as ANSI chars, for example).

What I would need is the html body in the original encoding so that it matches with the meta tags.

How to reproduce: code & error stack trace

Load non-UTF8 message from the server and check the bytes, umlauts will be encoded as UTF8 automatically although the server said the message part was not UTF8 encoded.

Expected behavior

getBodyHtml should return the HTML body in the original encoding or have a parameter to disable to forced UTF8 encoding.

@jahrralf jahrralf added the bug label Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant