Use a sane default encoding for messages that do not define their encoding
mfb - September 17, 2009 - 22:29
| Project: | Mailhandler |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
I found that messages from txt.att.net do not define their encoding. If the encoding is undefined, messages with "illegal" characters will be cut off. For example, "Mañana" becomes "Ma". Most e-mail clients are able to deal with undefined encodings and I suggest mailhandler should be able to as well, by using a sane default encoding.
Sample code to reproduce this issue:
<?php
drupal_set_message(drupal_convert_to_utf8('Mañana', NULL));
?>This patch defines the default encoding as Windows-1252, which in my experience is the most common encoding for e-mail messages that do not define their encoding.
| Attachment | Size |
|---|---|
| encoding.patch | 803 bytes |

#1
@mfb what do you think allowing default/fallback encoding to be set per-mailbox?
#2
I don't need such a setting myself but sure, if it's useful for someone :)
#3
Awesome!!, I lost many time finding what I need do to fix it. Thanks!!!, may be this move to stable version?
Gracias!, supongo que el uso de la Ñ te hace de habla hispana o tienes clientes de habla hispana. Saludos!!
#4
I'd use UTF-8 to encourage more people to use it as their default encoding, and if we set it, it should probably be configurable.
I'm not sure it should be a per-mailbox setting. It seem to me it would be more useful as a site-wide configuration, so if it needs to be changed, it should only be changed once (I don't expect anyone to change it more than once on a site)
#5
@z.stolar Agreed - site wide setting seems sufficient. What's the best way to offer this setting on the user interface? A textfield like in the attached patch, defaulted to UTF-8?
#6
Yes, that seem like the right place to do it.
#7
I applied the patch in #5 to 6.1. Will apply to 6.2 as well. Marking this as fixed.