+
+/*
+ * Encode a message header using RFC 2047 encoding. If the message contains
+ * no non-ASCII characters, then leave the header as-is.
+ *
+ * Arguments include:
+ *
+ * name - Message header name
+ * value - Message header content; must point to allocated memory
+ * (may be changed if encoding is necessary)
+ * charset - Charset used for encoding. If NULL, obtain from system
+ * locale.
+ *
+ * Returns 0 on success, any other value on failure.
+ */
+
+int encode_rfc2047(const char *name, char **value, const char *charset);