FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to control charset output?
#1
I have a problem with the charset output in emails send from swift, simply put is there any way to control what charset the email is sent?

In my form displaying the email in test view all looks fine, but on submission of form the email sent strip out special language chars.

Quote:There has been a submission made through your form, AMB Order:

Order ID: 2
Faktura Period: Kvartal
Namn: Joakim Schramm
r: 1957
Fdelsetid: 13:18
Fdelseplats: Olofstrm
Land: Sverige
Extra Info: Lite text
Email: joakim@astrocalc.se
Tidigare MB kund: Yes
Dag: 13
Mnad: 7
Kund ID: 2924
Starta Omedelbart: on
IP Address: 213.226.226.190

Submission made: 7 Apr 2009, 0:09

while it should look like
Quote:There has been a submission made through your form, AMB Order:

Order ID: 2
Faktura Period: Kvartal
Namn: Joakim Schramm
År: 1957
Födelsetid: 13:18
Födelseplats: Olofström
Land: Sverige
Extra Info: Lite text
Email: joakim@astrocalc.se
Tidigare MB kund: Yes
Dag: 13
Mnad: 7
Kund ID: 2924
Starta Omedelbart: on
IP Address: 213.226.226.190

Submission made: 7 Apr 2009, 0:09

Checking the email header it appear to be sent in utf-8 but swift does not seem to pass on data in a suitable way or what happens.
Reply
#2
Hi Yettn,

Ahh... you make a good point. Swift Mailer uses ISO-8559-1 by default - which is actually incorrect. It should use UTF-8, since that's the format in which the information is stored.

As a temporary fix, try this. On line 172 of the /modules/swift_mailer/library.php file, add this line:

PHP Code:
$email->setCharset("utf-8"); 

This is right before these two lines:

PHP Code:
// now compile the recipient list
$recipients =& new Swift_RecipientList(); 

Clearly, this should be a configurable option.

I plan on adding this and the option to define the return-path header in an upcoming release of the module. Once it's available, you can just upgrade and use that instead - but in the meantime hopefully the above will suffice.

Let me know if it works, btw!

- Ben
Reply
#3
Doesn't seam to help, same result. However, I found the 2 rows you pointed to at line 212 and not 172? I think swift had an update the other day if I remember correct and maybe you looked at an older version or am I out of line?

In any case no change here.
Reply
#4
Rats... that should have helped... I don't suppose it would be possible for you to send me your FT login info + FTP info so I could debug it on your site? No worries if not, but my email is formtools@encorewebstudios.com if so.

And I wouldn't worry about the line number difference; often files getting uploaded via FTP in the wrong format have extra newlines inserted.

- Ben
Reply
#5
I went into the code and tried a few things both with charsets and encoding but nothing helped. However then I tested to use html mail and then none of the special chars was stripped, only for text email. Display inside FT2 works fine, it's only when the (text)mail is sent.

I have no problems with you debugging but I am fine with using html mail now as it's only admin mails, but maybe later.
Reply
#6
Hey Yettn.

What email client are you using to read/view the emails? I've just been testing it out by copying & pasting your email content and it's working fine for me with both HTML + text email. I'm using Gmail.

Could you perhaps try checking your email in different email clients and see if that fixes it? It's possible that the client itself is at fault...!

- Ben
Reply
#7
(Apr 8th, 2009, 11:29 AM)Ben Wrote: Hey Yettn.

What email client are you using to read/view the emails? I've just been testing it out by copying & pasting your email content and it's working fine for me with both HTML + text email. I'm using Gmail.

Could you perhaps try checking your email in different email clients and see if that fixes it? It's possible that the client itself is at fault...!

- Ben

Ben,

you made a good point, I am using Outlook 2007 but when I change the configuration to use my gmail.com account instead, text emails works fine.

So probalem solved sorta or not, being dependant on M$ but at least now there is a way I can deal with it.
Reply
#8
Good to know, thanks!

Just FYI, I've just released an update to the module to include a "return-path" option (i.e. letting you specify where undeliverable emails get sent). This release also now explicitly set the charset to UTF-8 for all emails sent out. This should have been done initially - my bad!

- Ben
Reply
#9
(Apr 9th, 2009, 5:14 PM)Ben Wrote: Good to know, thanks!

Just FYI, I've just released an update to the module to include a "return-path" option (i.e. letting you specify where undeliverable emails get sent). This release also now explicitly set the charset to UTF-8 for all emails sent out. This should have been done initially - my bad!

- Ben

I must say after the last update of swift mailer this issue got worse :-(

I don't know if it's relater to my server configuration or not, which indeed is set up for utf-8, but now the parts before displaying ok and especially what's stored in DB is messed up, also for gmail. Before at least all data was stored correctly so I could get the missing parts from inside ft2 view but now not.

I know unicode can be a bit tricky, but are you using the mbstring library at http://php.net/manual/en/ref.mbstring.php ?

I know some code I worked on I didn't get to work until I used it.

And how can I quickly/temporary change back while this get fixed as now I get incomplete data from people nad have to send an extra email asking for completion?
Reply
#10
Ah! I'm so sorry, yettn - I don't believe I mentioned that this latest version explicitly sets all emails to be sent in UTF-8. That was something that should have been done initially, since the content is stored in the DB as UTF-8.

Look in the Swift Mailer file (I think it's just library.php in the root - but I could be mistaken) for setCharset(). I'd try manually editing it to send as ISO-8559-2 or something...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)