Skip to content

MailboxAddress encoding with first or last word containing non-ascii char #1093

@GuillaumeErgole

Description

@GuillaumeErgole

Describe the bug
When the first or last word of a MailboxAddress.Name contains some non-ascii char, the double-quotes are not at the correct place in encoded result.

Platform:

  • OS: Windows
  • .NET Runtime: .NET8
  • .NET Framework: .Net Standard 2.0 / .NET8
  • MimeKit Version: 4.8.0

To Reproduce

using MimeKit;

var address = new MailboxAddress("Département Formation, Recherche et Support", "formation@company.com");

var actual = address.ToString(true);
// actual: "=?utf-8?q?D=C3=A9partement?= \"Formation, Recherche et Support\"\r\n\t<formation@company.com>"
// expected: "\"=?utf-8?q?D=C3=A9partement?= Formation, Recherche et Support\"\r\n\t<formation@company.com>"


var address2 = new MailboxAddress("Département Formation, Recherche et Développement", "formation@company.com");

var actual2 = address2.ToString(true);
// actual2: "=?utf-8?q?D=C3=A9partement?= \"Formation, Recherche et\"\r\n =?utf-8?q?D=C3=A9veloppement?= <formation@company.com>"
// expected2: "\"=?utf-8?q?D=C3=A9partement?= Formation, Recherche et\r\n =?utf-8?q?D=C3=A9veloppement?=\" <formation@company.com>"

Expected behavior
With the actual behavior Outlook display :
image

Double quotes shouldn't be here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3rd-party-client-bugThe bug appears to be in the other clientcompatibilityCompatibility with existing software

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions