[drupal-devel] Email filter

Steven Wittens steven at acko.net
Sun Mar 13 15:40:30 UTC 2005


> On another related topic, does anyone know how to tweak the 
> mailhandler and listhandler to deal with the non-ASCII characters 
> (such as ø, etc.) that come through in the usernames, subject lines 
> and message bodies? At the moment these characters are all converted 
> to ?. I've tried some experiments with drupal_convert_to_utf8() but 
> I've had no luck so far.

Message bodies should be easy to convert with drupal_convert_to_utf8(), 
provided they are transferred in 8-bit mode (Content-Transfer-Encoding), 
which is what the large majority of mail clients does today. You will 
need iconv/mbstring/recode support. I would very much advise against 
hacking in utf8_encode() as Tim Altman suggests, as this function can 
only handle ISO-8859-1 and not Windows-1252 (the Microsoft-specific 
variant of ISO-8859-1, with smart quotes, euro-sign, etc), which is used 
a lot.

For subject lines and such, the situation is trickier, as a separate 
method of encoding these parameters is used. See RFC 2047:
http://www.rfc-editor.org/rfc/rfc2047.txt

We have a function mime_header_encode(), but no mime_header_decode().

As far as "characters are being converted to '?'" goes, is this is a 
real question mark or the replacement character U+FFFD (�)?

Steven Wittens




More information about the drupal-devel mailing list