1 unicode.inc _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

core/includes/unicode.inc, line 434
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 = backdrop_convert_to_utf8($data, $matches[1]);
  }
  return $data;
}