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::UndefinedConversionError: "\xC3" from ASCII-8BIT to UTF-8 #229

Open
LaurensN opened this issue Jun 12, 2017 · 6 comments
Open
Labels

Comments

@LaurensN
Copy link
Contributor

LaurensN commented Jun 12, 2017

[2017-06-12T12:35:13.472] FATAL -- : ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
[2017-06-12T12:35:13.472] FATAL -- :     15:         or the e-mail didn't include a plain text part.
    16:   - else
    17:     %pre.codeBlock= @message.plain_body
[2017-06-12T12:35:13.472] FATAL -- :
[2017-06-12T12:35:13.472] FATAL -- : app/views/messages/plain.html.haml:18:in `_app_views_messages_plain_html_haml__809546143829012049_70075317594600'

The e-mail contains a body / text part.

I can't find the character that causes the issue in the raw EML download.

Possible solution to force encoding ?

@willpower232
Copy link
Collaborator

which programming language/client are you using?

@LaurensN
Copy link
Contributor Author

Hi @willpower232,

I have no idea which e-mail client sent the e-mail to our Postal server (it seems like it was an auto-reply).
I'll investigate further ASAP.

@LaurensN
Copy link
Contributor Author

LaurensN commented Jun 13, 2017

From the Postal headers tab:

X-Postal-Spam: no
X-Postal-Spam-Threshold: 5.0
X-Postal-Spam-Score: 0.0
X-Postal-Threat: no
Received: from xxxx by xxxx with SMTP; Mon, 12 Jun 2017 10:32:37 +0000
Received: from mail by xxxx with local (Exim 4.80)
	id xxxx
	for xxxx; Mon, 12 Jun 2017 12:32:36 +0200
From: xxxx
To: xxxx
Subject: xxxx
In-Reply-To: <xxxx>
References: <xxxx>
Auto-Submitted: auto-replied
Message-Id: <xxxx>
Date: Mon, 12 Jun 2017 12:32:36 +0200

The only "special" character in the e-mail body is 'ö'.

@catphish
Copy link
Contributor

Looking at those headers, it appears this email has no Content-Type or Content-Encoding headers to indicate that it is not an ASCII email. It therefore should not contain any non-ASCII characters at all. This email was therefore probably generated by a broken email server.

We often find that emails with invalid encoding trigger errors such as the one you are seeing. We will add some code to detect this error and process the email as well as possible, stripping out the invalid non-ASCII characters.

@catphish catphish added the bug label Jun 13, 2017
@dtrckd
Copy link

dtrckd commented Jun 28, 2022

I also got a similar error.

  • postal version 2.1.1
  • The email client is thunderbird 78.14
  • the server is configured to follow the email to an http endpoint with
    • sent the body as json
    • delivered as hash
    • try to seperate replies/signature

From the web interface:

Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8
Support Ref: J-PH[...]

And from the docker logs

[9] [2022-06-28T16:50:32.104] INFO -- : Completed 500 Internal Server Error in 39ms (ActiveRecord: 5.3ms)
[9] [2022-06-28T16:50:32.105] FATAL -- :   
[9] [2022-06-28T16:50:32.105] FATAL -- : ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
[9] [2022-06-28T16:50:32.106] FATAL -- :     15:         or the e-mail didn't include a plain text part.
    16:   - else
    17:     %pre.codeBlock= @message.plain_body
[9] [2022-06-28T16:50:32.106] FATAL -- :   
[9] [2022-06-28T16:50:32.106] FATAL -- : app/views/messages/plain.html.haml:18:in `_app_views_messages_plain_html_haml__250971508879007162_70223690379740'

I am not sure about the undefined character as the email is a really plain text message.
Could not reproduce as for now.

@usr-h
Copy link

usr-h commented Jun 16, 2023

missing meta utf-8 in raw_html
in 2.1.2 ver. exist in 2.1.4 not exist

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

5 participants