ddeboer / imap

Object-oriented, fully tested PHP IMAP library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsupported charset "us=ascii"

guldil opened this issue · comments

Q A
ddeboer/imap version 1.12
PHP version 7.4.16
IMAP provider mdaemon 18

Summary

I'm trying to backup 400 000 emails and i have some random error about charset from very old emails (> 10 years !)

Unsupported charset :

[E_WARNING] Unsupported charset "us=ascii": mb_convert_encoding(): Illegal character encoding specified
imap_alerts (0):
imap_errors (0): #0 vendor/ddeboer/imap/src/Message/AbstractPart.php(231): Ddeboer\Imap\Message\Transcoder::decode()

Current behavior

Email message is not readable.

How to reproduce: code & error stack trace

Exemple with us=ascii :

Return-path: <xxxxxxxxxxxxx@xxxxx.fr>
Authentication-Results: xxxxxx.net
	smtp.mail=xxxxx@xxx.fr; auth=pass
Received: from xxx-xxxx by xxxx.net
	(MDaemon PRO v9.0.6)
	with ESMTP id md50000059333.msg
	for <xxxxx.xxxxx@xxxx.fr>; Mon, 12 Feb 2007 14:17:12 +0100
Date: Mon, 12 Feb 2007 14:17:00 +0100
From: xxxxx xxxxxx<xxxxxxxx@xxxxxx.fr>
Subject: RE: Urgent !
To: 'xxxxxx xxxxxxx' <xxxxxx.xxxxxxx@l3ia.fr>
X-Priority: 3
X-Mailer: Outlook Connector for MDaemon 2.1.2
MIME-Version: 1.0
Content-Type: text/PLAIN; charset=us=ascii
X-Authenticated-Sender: xxxxxxxxxxxx@xxxxx.fr
X-Spam-Processed: xxxxx.net, Mon, 12 Feb 2007 14:17:12 +0100
	(not processed: sender in recipient's private address book)
X-MDRcpt-To: xxxxxxxxxxxxxxxxx@xxxxxx.fr
X-Rcpt-To: xxxxxxxxxxxxx@xxxxxx.fr
X-MDRemoteIP: xxxxxxxxxxxxxxxx
X-Return-Path: xxxxxxxxxxxxx@xxxxxxx.fr
X-Envelope-From: xxxxxxxxxxxxx@xxxxxxxx.fr
X-MDaemon-Deliver-To: xxxxxxxxxxx@xxxxxx.fr
X-MDAV-Processed: l3ia.net, Mon, 12 Feb 2007 14:17:12 +0100

Expected behavior

No error because us=ascii is a valid charset : https://www.charset.org/charsets/us-ascii :)

I add 'us=ascii' => 'us-ascii' in vendor/ddeboer/imap/src/Message/Transcoder.php and it's working !

Hi, can you propose a PR with your fix please?