Problems on long subjects with UTF8 charset

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
oldrich
Forum Newbie
Posts: 1
Joined: Wed Apr 25, 2007 1:09 pm

Problems on long subjects with UTF8 charset

Post by oldrich »

I like SwiftMailer, but I have to report the bug.
I use Swift-3.1.5-php4
Wrong longer subject with utf8 charset - bad compartmentalization.
UTF-8 uses one to four bytes per character, depending on the Unicode symbol.

Swift now produces
Subject: =?utf-8?Q?Varov=C3=A1n=C3=AD_p=C5=99ed_expirac=C3=AD_dom=C3?=
=?utf-8?Q?=A9ny_logomix?=

it should be like this
Subject: =?utf-8?Q?Varov=C3=A1n=C3=AD_p=C5=99ed_expirac=C3=AD_dom=C3=A9?=
=?utf-8?Q?ny_logomix?=

Thank you
Oldrich
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Can anyone provide a patch for this? Or an explanation of how I would detect where it's safe to cut the string? :( I didn't actually think decoding would be affected by this since I expected it to simply convert back to the original byte order. Base64 encoded headers should provide you with a temporary solution:

Code: Select all

$message->headers->setEncoding("B");
I'd love some guidance from someone well-versed in character encodings because RFC 2822 does not cover this stuff.

Thanks for the heads-up :)

EDIT | Educated guess work here, but is the =C3 signficant in detecting this?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Update: Thread created here for support on the encoding issue since I'm no expert with UTF-8.
Post Reply