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()

Helper function to mime_header_decode

1 string reference to '_mime_header_decode'
mime_header_decode in includes/unicode.inc
Complement to mime_header_encode

File

includes/unicode.inc, line 254

Code

function _mime_header_decode($matches) {

  // Regexp groups:
  // 1: Character set name
  // 2: Escaping method (Q or B)
  // 3: Encoded data
  $data = $matches[2] == 'B' ? base64_decode($matches[3]) : str_replace('_', ' ', quoted_printable_decode($matches[3]));
  if (strtolower($matches[1]) != 'utf-8') {
    $data = drupal_convert_to_utf8($data, $matches[1]);
  }
  return $data;
}