You are here

function mime_header_decode in Drupal 4

Same name and namespace in other branches
  1. 5 includes/unicode.inc \mime_header_decode()
  2. 6 includes/unicode.inc \mime_header_decode()
  3. 7 includes/unicode.inc \mime_header_decode()

Complement to mime_header_encode

File

includes/unicode.inc, line 244

Code

function mime_header_decode($header) {

  // First step: encoded chunks followed by other encoded chunks (need to collapse whitespace)
  $header = preg_replace_callback('/=\\?([^?]+)\\?(Q|B)\\?([^?]+|\\?(?!=))\\?=\\s+(?==\\?)/', '_mime_header_decode', $header);

  // Second step: remaining chunks (do not collapse whitespace)
  return preg_replace_callback('/=\\?([^?]+)\\?(Q|B)\\?([^?]+|\\?(?!=))\\?=/', '_mime_header_decode', $header);
}