You are here

public static function PHPExcel_Shared_String::ConvertEncoding in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php \PHPExcel_Shared_String::ConvertEncoding()

* Convert string from one encoding to another. First try mbstring, then iconv, finally strlen * *

Parameters

string $value: * @param string $to Encoding to convert to, e.g. 'UTF-8' * @param string $from Encoding to convert from, e.g. 'UTF-16LE' * @return string

9 calls to PHPExcel_Shared_String::ConvertEncoding()
PHPExcel_Reader_CSV::loadIntoExisting in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/CSV.php
* Loads PHPExcel from file into PHPExcel instance * *
PHPExcel_Reader_Excel2003XML::_convertStringEncoding in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2003XML.php
PHPExcel_Reader_Excel5::_decodeCodepage in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Convert string to UTF-8. Only used for BIFF5. * *
PHPExcel_Reader_Excel5::_encodeUTF16 in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Get UTF-8 string from (compressed or uncompressed) UTF-16 string * *
PHPExcel_Reader_Excel5::_readDocumentSummaryInformation in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Read additional document summary information

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php, line 493

Class

PHPExcel_Shared_String
PHPExcel_Shared_String

Code

public static function ConvertEncoding($value, $to, $from) {
  if (self::getIsIconvEnabled()) {
    return iconv($from, $to, $value);
  }
  if (self::getIsMbstringEnabled()) {
    return mb_convert_encoding($value, $to, $from);
  }
  if ($from == 'UTF-16LE') {
    return self::utf16_decode($value, false);
  }
  else {
    if ($from == 'UTF-16BE') {
      return self::utf16_decode($value);
    }
  }

  // else, no conversion
  return $value;
}