commit 654cb90c9cc5b1540fbfd6cd378445e611df9316
parent 195012cef85b40e9c384a5c8ea5253e18a8558f1
Author: Adeodato Simó <dato@net.com.org.es>
Date: Fri, 10 Jul 2009 17:00:29 +0200
mime-decode hook: provide a "charset" variable with the attachment charset
This is useful, for example, for HTML attachments which are sent in a
charset different from the default for the system (eg., ISO-8859-1 on an
UTF-8 system), so that the converter program can be told what charset it
should be converting from.
Signed-off-by: Adeodato Simó
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
@@ -50,7 +50,8 @@ directly in Sup. For attachments that you wish to use a separate program
to view (e.g. images), you should use the mime-view hook instead.
Variables:
- content_type: the content-type of the message
+ content_type: the content-type of the attachment
+ charset: the charset of the attachment, if applicable
filename: the filename of the attachment as saved to disk
sibling_types: if this attachment is part of a multipart MIME attachment,
an array of content-types for all attachments. Otherwise,
@@ -102,6 +103,7 @@ EOS
else
HookManager.run "mime-decode", :content_type => content_type,
:filename => lambda { write_to_disk },
+ :charset => encoded_content.charset,
:sibling_types => sibling_types
end