Interested in improving this site? Please check the To Do page.

Back to String Verbs

string.mimeHeaderDecode

Determines if a string was encoded according to RFC 2047, decodes it, stores the name of the character set used by the string at adrCharsetName^, and returns the decoded string.

Syntax

mimeHeaderDecode( s, adrCharsetName )

Params

  • s is an internet header string (probably SMTP or HTTP) that may need to be decoded
  • adrCharsetName is the address of a string variable where the name of character set (as specified in the header) will be stored

Returns

  • The RFC2047-decoded string.
  • Also, the name of the character set used by the string is returned at adrCharsetName^

Examples

local ( s = "=?utf-8?q?this=20is=20a=20test?=" );

“this is a test” plus, the value of charset is now “utf-8” <code> local ( charset = ”” ); s = string.mimeHeaderDecode( s, @charset ) </code> ===== Notes ===== Email headers, especially the subject line, often contain characters outside of the ASCII range.