La Vita è Bella

Saturday, March 28, 2009

NucleusCMS patch: use UTF-8 base64 to encode email subject

The emails sent by NucleusCMS (e.g. new comment notification) didn't encode the subject, but just put the raw text there. For english language file, that's OK. But for other languages such as Chinese, it's not that good. It will produce garbled text on the subject (but not always garbled, weird).

So I wrote this patch to resolve this problem. Google tell me that if I want to encode an email subject in PHP, I should use the mb_encode_mimeheader() function. But Dreamhost just didn't provide any mb_ functions in PHP. I dug more about email subject encoding, and found that a hardcoded base64 should just do the trick. As the original sending mail code in NucleusCMS hardcoded UTF-8 in the Content-Type, I assume that hardcode UTF-8 in the subject is fine, too.



tags: , , , , , , ,

00:10:27 by fishy - dev - Permanent Link

Revision: 1.0/1.0, last modified on 2009-03-27 @ 01:10.

Karma: -25 (42.69% out of 171 were positive) [+/-]

You can subscribe to RSS 2.0 feed for comments and trackbacks

Trackbacks:
There are currently no trackbacks for this item.
Use this TrackBack url to ping this item (right-click, copy link target). If your blog does not support Trackbacks you can manually add your trackback by using this form.

John Davidson

John Davidson wrote:

I run a Nucleus site with non-English speaking users who frequently send emails in languages that require a different charset, such as UTF-8. The emails I have been receiving so far are unreadable. Can I change the character encoding of email messages sent through the Nucleus member mail form?

Thursday, November 24, 2011 21:20:56

Add Comment

 

May the Force be with you. RAmen