src/Drupal/Component/Utility/Unicode.php
public static function convertToUtf8($data, $encoding) {
    if (function_exists('iconv')) {
      return @iconv($encoding, 'utf-8', $data);
    }
    elseif (function_exists('mb_convert_encoding')) {
      return @mb_convert_encoding($data, 'utf-8', $encoding);
    }
    elseif (function_exists('recode_string')) {
      return @recode_string($encoding . '..utf-8', $data);
    }
    // Cannot convert.
    return FALSE;
  }
public static function convertToUtf8($data, $encoding) {
    if (function_exists('iconv')) {
      return @iconv($encoding, 'utf-8', $data);
    }
    elseif (function_exists('mb_convert_encoding')) {
      return @mb_convert_encoding($data, 'utf-8', $encoding);
    }
    elseif (function_exists('recode_string')) {
      return @recode_string($encoding . '..utf-8', $data);
    }
    // Cannot convert.
    return FALSE;
  }
public static function convertToUtf8 ( $ data , $ encoding ) { if ( function_exists ( 'iconv' ) ) { return @ iconv ( $ encoding , 'utf-8' , $ data ) ; } elseif ( function_exists ( 'mb_convert_encoding' ) ) { return @ mb_convert_encoding ( $ data , 'utf-8' , $ encoding ) ; } elseif ( function_exists ( 'recode_string' ) ) { return @ recode_string ( $ encoding . '..utf-8' , $ data ) ; } // Cannot convert. return FALSE ; }
Converts data to UTF-8.

Requires the iconv, GNU recode or mbstring PHP extension.

@param string $data
The data to be converted.
@param string $encoding
The encoding that the data is in.

@return string|bool
Converted data or FALSE.
Converts data to UTF - 8 .