Hastymail2

Hastymail2 is an Open Source IMAP webmail client written in PHP. Our focus is compliance, usability, security, and speed.

Hastymail 2

avatar
Problems sending e-mails containing characters as åäö

Hi,

Running version RC7 set to encode outgoing mails with 8bit, but same applies to base64 and quoted-printable as well. When I send it converts åäö, and guessing all non 7-bit ASCII chars as well wrong. There is a a really easy way to test this: Compose a new mail without entering any address and enter some of those chars, hit send and when the page returns with the "No valid recipient addresses found" error those chars will be stripped or displayed wrong in the subject and textarea already.

If I send the mail to myself I can read it ok in Hastymail, but when checked, in another clients such as Squirrelmail, Thunderbird or Hotmail it's all wrong and have switched all UTF-8 chars to ??? or error boxes instead. Headers of the mail are:

Subject: Testar =?UTF-8?B?5eT2?=
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: base64

Why does it go UTF8, when the HTML page is served in ISO-8859-1 to me, or do you actually do a ISO-8859-1 to UTF8 conversion in the code?

An idea I have is that you are missing a "<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />" in the header of the HTML output.

 

Or is this just a configuration error on my part?

// juKay

Reply /Quote
avatar
Problems sending e-mails containing characters as åäö

Seems this forum gets it all wrong as well, out on the topic list it shows åäö right, but when reading a topic it shows it wrong in the subject but ok down in the body.

Reply /Quote
avatar
Re: Problems sending e-mails containing characters as ...

I am not surprised that the forums don't handle non-ascii characters correctly but Hastymail should. I just copied the 3 from your post and pasted them into the compose page, hit send without a valid recipient, and the page reloaded with the correctly encoded characters in the message body. I will continue to try to reproduce the problem. What browser are you using?

Thanks for the feedback,
Jason

Reply /Quote
avatar
follow up
I was testing it with FF 3.5.2 on a Windows Vista box. I then went ahead and tried with FF 3.5.2, MSIE 8.0, Opera 9.64, Chrome 2.0.172.39 and Safari 3.2.1. The only browser that it worked with and actually also produced a mail that was readable by other clients was MSIE. The difference is that MSIE was using UTF-8 to render the page all others fell back to ISO-8859-1. The meta line I included above should fix that error for all browsers.
Reply /Quote
avatar
follow up
Come to think of it, dunno if that meta will work for ppl in out countries or not. It's all depending on how you handle text inside hastymail, if you always handle it as utf-8 it should be fine.
Reply /Quote
avatar
Re: follow up

Hastymail always handles text for display as UTF-8. Any other charsets are converted prior to building the html page. The xml declaration of the hastymail output contains the charset, but it can't hurt to add the meta tag as well. I guess the reason I cannot reproduce the problems you are seeing is because my browser knows the content type is UTF-8. The tag has been added to SVN, Rev 1008.

Thanks for the feedback,
Jason

Reply /Quote
avatar
follow up

Now it works like a charm for me, only tested it with FF but it should be the same for the rest of them.

I'm guessing the difference from your server and mine is that we default to ISO-8859-1 in Apache if no Content-Type is set, if you are running Apache to start with that is.

Anyway AddDefaultCharset is the option in Apache where you can do magic and force all unknown output to another type. If someone else is having this problem and just want to fix it quick without running the latest svn version, just make a simple .htaccess file in your Hastymail2 folder and add "AddDefaultCharset UTF-8"

Reply /Quote
avatar
Re: follow up

Thanks for the follow up, glad that the meta tag did the trick. I do most of my testing with apache on multiple systems, though I also test with Cherokee sometimes. I have never had a problem with the charset not being set but I don't know if my setups are defaulting to utf-8. The fix is a good one though and I appreciate your feedback to help resolve it.

Take care,
Jason

Reply /Quote
Get Hastymail at SourceForge.net. Fast, secure and Free Open Source software downloads