private function Unescaper::convertEncoding

Convert a string from one encoding to another.

Parameters

string $value The string to convert:

string $to The input encoding:

string $from The output encoding:

Return value

string The string with the new encoding

Throws

\RuntimeException if no suitable encoding function is found (iconv or mbstring)

1 call to Unescaper::convertEncoding()
Unescaper::unescapeCharacter in drupal/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php
Unescapes a character that was found in a double-quoted string

File

drupal/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php, line 135

Class

Unescaper
Unescaper encapsulates unescaping rules for single and double-quoted YAML strings.

Namespace

Symfony\Component\Yaml

Code

private function convertEncoding($value, $to, $from) {
  if (function_exists('mb_convert_encoding')) {
    return mb_convert_encoding($value, $to, $from);
  }
  elseif (function_exists('iconv')) {
    return iconv($from, $to, $value);
  }
  throw new \RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).');
}