subject of sent message gets corrupted !!
Moderators: Chris Corbyn, General Moderators
subject of sent message gets corrupted !!
I have tried to send an email for Arabic text (with UTF-8 encoding) and the subject gets corrupted when certain Arabic characters are used.
for GMail,, these characters appear instead of some of the characters ��
Yahoo doesn't understand the subject and displays only ��������������������
I always use:
$message->setContentType("text/html");
$message->headers->setCharset('utf-8');
The header appear as follows for the subject field:
Subject: =?utf-8?B?2LHYs9in2YTYqSDZhdmGINin2YTYpdiv2KfYsdipINmE2YTY?=
=?utf-8?B?udi22Yg=?=
Please note the addition of =?utf-8?B? twice ?? why is it doing that ?
The Arabic characters that these weird looking characters replace are لع (two characters combined ,, when separate they look ل then ع )
Any hint or workaround is really appreciated.
for GMail,, these characters appear instead of some of the characters ��
Yahoo doesn't understand the subject and displays only ��������������������
I always use:
$message->setContentType("text/html");
$message->headers->setCharset('utf-8');
The header appear as follows for the subject field:
Subject: =?utf-8?B?2LHYs9in2YTYqSDZhdmGINin2YTYpdiv2KfYsdipINmE2YTY?=
=?utf-8?B?udi22Yg=?=
Please note the addition of =?utf-8?B? twice ?? why is it doing that ?
The Arabic characters that these weird looking characters replace are لع (two characters combined ,, when separate they look ل then ع )
Any hint or workaround is really appreciated.
Re: subject of sent message gets corrupted !!
I think I have an idea what is happening,,
basically, the encoding of the subject line is broken into several lines. Sometimes,, it breaks one character into two lines, and hence the weird looking character � appears instead of the actual character (it appears twice by the way)..
I think this is the cause,, but I have no idea how to fix this.. Any hints/ help is really appreciated...
basically, the encoding of the subject line is broken into several lines. Sometimes,, it breaks one character into two lines, and hence the weird looking character � appears instead of the actual character (it appears twice by the way)..
I think this is the cause,, but I have no idea how to fix this.. Any hints/ help is really appreciated...
Re: subject of sent message gets corrupted !!
After much digging, I believe the problem is caused by the substr() function... It is simply not UTF8 safe.. Please read on... http://www.phpwact.org/php/i18n/utf-8
Maybe using mb_substr would be safer ??
This should be fixed if a substitute to the php substr() is being used the native substr() is not UTF-8 safe and can damage UTF8 strings Using mb_substr() instead should fix the problem
http://uk3.php.net/manual/en/function.mb-substr.php
The encoding of subjects is where the substr() function is being used
Maybe using mb_substr would be safer ??
This should be fixed if a substitute to the php substr() is being used the native substr() is not UTF-8 safe and can damage UTF8 strings Using mb_substr() instead should fix the problem
http://uk3.php.net/manual/en/function.mb-substr.php
The encoding of subjects is where the substr() function is being used
Re: subject of sent message gets corrupted !!
The patch applied here should work for swiftMailer too:
http://trac.symfony-project.org/attachm ... ding.patch
This should go to the bug tracking section,, who can I apply the above fix to SwiftMailer ??
http://trac.symfony-project.org/attachm ... ding.patch
This should go to the bug tracking section,, who can I apply the above fix to SwiftMailer ??
Re: subject of sent message gets corrupted !!
Is this ever going to be fixed ??
Is SwiftMailer a dead project ??
Is SwiftMailer a dead project ??
Re: subject of sent message gets corrupted !!
Any chance this might be fixed sometime soon ??
Re: subject of sent message gets corrupted !!
If you are using UTF-8 encoding ALL PHP your code should be carefully checked for proper use. There are many non utf8 safe string functions that if used with utf-8 data will break them. Always use the mb_ equivalent functions.
As far as Swiftmailer goes, it does have a problem with passing UTF8 text in either the From: field or Subject field depending on which version you are using. Version 3.2.6 causes a problem with the From: field, and later versions fix it but then introduce a bug in the Subject field.
I have been in discussion with Chris previously about this and version 4 will fix the problem.
Oh, and it won't make a difference whether you set the encoding to Base64 or the default QP encoding.
As far as Swiftmailer goes, it does have a problem with passing UTF8 text in either the From: field or Subject field depending on which version you are using. Version 3.2.6 causes a problem with the From: field, and later versions fix it but then introduce a bug in the Subject field.
I have been in discussion with Chris previously about this and version 4 will fix the problem.
Oh, and it won't make a difference whether you set the encoding to Base64 or the default QP encoding.
Re: subject of sent message gets corrupted !!
This is not good news at all. It has been over 7 months since you have been promised a fix for this issue. who knows if it will ever be fixed..andyb wrote: As far as Swiftmailer goes, it does have a problem with passing UTF8 text in either the From: field or Subject field depending on which version you are using. Version 3.2.6 causes a problem with the From: field, and later versions fix it but then introduce a bug in the Subject field.
I have been in discussion with Chris previously about this and version 4 will fix the problem.
Oh, and it won't make a difference whether you set the encoding to Base64 or the default QP encoding.
Any good alternative to SwiftMailer ??? I need to deploy it in my system asap...
Re: subject of sent message gets corrupted !!
Yes I have been waiting months too, Chris promised version 4 would fix the problem, it has gone terribly quiet at the moment though from Chris.....
Re: subject of sent message gets corrupted !!
I have the same issue with my plugin: Cimy Swift SMTP for WordPress.
One chinese user provided me a real subject that got corrupted and is 100% reproducible.
I looked at the code to patch it myself, but is quite complicated do a patch that works AND that doesn't regress in some other ways.
bye
Marco
One chinese user provided me a real subject that got corrupted and is 100% reproducible.
I looked at the code to patch it myself, but is quite complicated do a patch that works AND that doesn't regress in some other ways.
bye
Marco
Re: subject of sent message gets corrupted !!
Just to let everyone know, although a supporter of Swiftmail, the lack of support recently has led me to look for other solutions due to some urgent demands.
I have come across a mail class called Nomad. Quite simply it works, where Swiftmail and PHPMailer fail, this works. I can send different languages in utf-8 including embedded images, have Russian text in From and Subject fields and it works!
I hope Chris the Developer of Swiftmail comes back online soon, but in the meantime give Nomad a try!
I have come across a mail class called Nomad. Quite simply it works, where Swiftmail and PHPMailer fail, this works. I can send different languages in utf-8 including embedded images, have Russian text in From and Subject fields and it works!
I hope Chris the Developer of Swiftmail comes back online soon, but in the meantime give Nomad a try!
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: subject of sent message gets corrupted !!
This bug is fixed in version 4. Version 4 is capable of reading strings per-character rather than per-byte.