Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview Text encoding issues #7017

Closed
miaulalala opened this issue Aug 16, 2022 · 1 comment · Fixed by #7104
Closed

Preview Text encoding issues #7017

miaulalala opened this issue Aug 16, 2022 · 1 comment · Fixed by #7104

Comments

@miaulalala
Copy link
Contributor

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

@ChristophWurst
Copy link
Member

ChristophWurst commented Aug 30, 2022

$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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants