Skip to content

Preview Text encoding issues #7017

Closed

Description

@miaulalala

Steps to reproduce

Follow Up to #6962 reported by @kesselb here

This email mail_5322.txt uses a weird encoding. It breaks the updatePreviewDataBulk process for me and rollback all changes.

The following code made it work. I'm not 100% sure if that's not a problem with my dev setup somehow.

$previewText = $message->getPreviewText();
if ($previewText !== null) {
    $previewText = mb_strcut(mb_convert_encoding($previewText, 'UTF-8', 'UTF-8'), 0, 255);
}

Expected behavior

The preview text is parsed correctly.

Actual behavior

Some encodings cause the preview text to fail.

Mail app version

1.14.0-alpha5

Mailserver or service

No response

Operating system

No response

PHP engine version

No response

Web server

No response

Database

No response

Additional info

No response

Activity

  1. ChristophWurst commented on Aug 30, 2022

    @ChristophWurst
    Member
    $previewText = $message->getPreviewText();
    if ($previewText !== null) {
        $previewText = mb_strcut(mb_convert_encoding($previewText, 'UTF-8', 'UTF-8'), 0, 255);
    }
    

    Let's do that. Done. I had a stash somewhere with a similar solution. Anything non UTF-8 can be discarded.

  2. added this to the v1.14.0 milestone on Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions