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

Distortion of characters when viewing the original message #2462

Closed
alglyzin opened this issue May 15, 2023 · 5 comments
Closed

Distortion of characters when viewing the original message #2462

alglyzin opened this issue May 15, 2023 · 5 comments
Labels

Comments

@alglyzin
Copy link

alglyzin commented May 15, 2023

After updating to the latest version 2.1.4, the html version incorrectly displays text other than English characters.
The email arrives in the correct encoding, but is viewed as in the screenshot:

2023-05-15_10-43-13

@alglyzin alglyzin added the bug label May 15, 2023
@usr-h
Copy link

usr-h commented Jun 9, 2023

I am also interested in what causes it and how it can be fixed...

@Paz08
Copy link

Paz08 commented Aug 2, 2023

Has anyone taken a look at this? I'm also experiencing the same issue and the clients are not happy about it...

@JustinBack
Copy link

Same issue, this happens for incoming E-Mails as well, resulting in the webhooks breaking the encoding and passing the invalid characters.

Seems this line is responsible for handling the encoding, though I don't have a fix

def decode_body_as_text
body_text = decode_body
charset_tmp = begin
Encoding.find(Ruby19.pick_encoding(charset))
rescue StandardError
"ASCII"
end
charset_tmp = "Windows-1252" if charset_tmp.to_s =~ /windows-?1258/i
if charset_tmp == Encoding.find("UTF-7")
body_text.force_encoding("UTF-8")
decoded = body_text.gsub(/\+.*?-/m) { |n| Base64.decode64(n[1..-2] + "===").force_encoding("UTF-16BE").encode("UTF-8") }
else
body_text.force_encoding(charset_tmp)
decoded = body_text.encode("utf-8", invalid: :replace, undef: :replace)
end
decoded.valid_encoding? ? decoded : decoded.encode("utf-16le", invalid: :replace, undef: :replace).encode("utf-8")
end

toptaran added a commit to toptaran/postal that referenced this issue Aug 29, 2023
@stereu
Copy link

stereu commented Oct 23, 2023

Fixed by #2596. Awaiting merge and release.

@Paz08
Copy link

Paz08 commented Jan 5, 2024

any news on this release?

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

6 participants