function _mime_header_decode

_mime_header_decode($matches)

Decodes encoded header data passed from mime_header_decode().

Callback for preg_replace_callback() within mime_header_decode().

Parameters

$matches: The array of matches from preg_replace_callback().

Return value

string The mime-decoded string.

See also

mime_header_decode()

File

includes/unicode.inc, line 437
Provides Unicode-related conversions and operations.

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!unicode.inc/function/_mime_header_decode/7.x