这是indexloc提供的服务,不要输入任何密码
Skip to content

Support fallback/ignore encoding #192

@fcuenca4

Description

@fcuenca4

Hey there! 👋

I'm using go-message for an email archiving application and ran into a challenge with emails that have invalid encoding.

The problem happens in the encodingReader function (https://github.com/emersion/go-message/blob/master/encoding.go) when it encounters malformed content.
For example, this email snippet:

Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML>
===
<html>
<body>
    <p>Hello, World!</p>
    <p>This has some =ZZ invalid quoted-printable stuff.</p>
    <p>Another example: =</p>
    <p>This text after the invalid parts never gets processed.</p>
</body>
</html>

The reader fails at the first invalid sequence, and we can't get any of the content.

For archiving purposes, I'd love an option to just get whatever content is available, even if some parts can't be decoded perfectly. I'm prioritizing content preservation over perfect rendering.

Maybe an option to skip encoding validation via Options?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions