Skip to content

Special chars in base64 encoded html body is not decoded correctly #572

Open
@ETES-Stuttgart

Description

@ETES-Stuttgart

Used config
the default config.

Code to Reproduce
Using the following raw test-message:

Return-Path: <test@example.net>
Content-Type: multipart/related;
	boundary="_634c13df-7dd6-4dba-a18b-f4da6e4aa3dd_"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: base64 encoded html body is not decoded correctly
From: test@example.net
To: test@example.de
Date: Wed, 22 Jan 2025 18:08:13 -0000
Message-ID: <133756929343.1201.5118972727319558135@test.example.net>

--_634c13df-7dd6-4dba-a18b-f4da6e4aa3dd_
Content-Transfer-Encoding: base64
Content-Type: text/html

c29tZSBzcGVjaWFsIGNoYXJzOiDimb/DpMO8w7Y=
--_634c13df-7dd6-4dba-a18b-f4da6e4aa3dd_

and the follwing test case:

public function testIssueEmail() {
    $filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "the-raw-message.eml"]);
    $message = Message::fromFile($filename);

    self::assertSame("some special chars: ♿äüö", $message->getHTMLBody());
}

Fails, because the html body is some special chars: �äßÜ.

In our fork of php-imap, we've also added this test case.

Expected behavior
The html body to be some special chars: ♿äüö

Desktop:

  • OS: Manjaro
  • PHP: 8.4
  • laravel-imap version 6.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions