You are here

private static function PHPExcel_Reader_Excel5::_readUnicodeString in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_readUnicodeString()

* Read Unicode string with no string length field, but with known character count * this function is under construction, needs to support rich text, and Asian phonetic settings * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3 * *

Parameters

string $subData: * @param int $characterCount * @return array

3 calls to PHPExcel_Reader_Excel5::_readUnicodeString()
PHPExcel_Reader_Excel5::_readDefinedName in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* DEFINEDNAME * * This record is part of a Link Table. It contains the name * and the token array of an internal defined name. Token * arrays of defined names contain tokens with aberrant * token classes. * *…
PHPExcel_Reader_Excel5::_readUnicodeStringLong in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Extracts an Excel Unicode long string (16-bit string length) * OpenOffice documentation: 2.5.3 * this function is under construction, needs to support rich text, and Asian phonetic settings * *
PHPExcel_Reader_Excel5::_readUnicodeStringShort in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Extracts an Excel Unicode short string (8-bit string length) * OpenOffice documentation: 2.5.3 * function will automatically find out where the Unicode string ends. * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php, line 6624

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private static function _readUnicodeString($subData, $characterCount) {
  $value = '';

  // offset: 0: size: 1; option flags
  // bit: 0; mask: 0x01; character compression (0 = compressed 8-bit, 1 = uncompressed 16-bit)
  $isCompressed = !((0x1 & ord($subData[0])) >> 0);

  // bit: 2; mask: 0x04; Asian phonetic settings
  $hasAsian = 0x4 & ord($subData[0]) >> 2;

  // bit: 3; mask: 0x08; Rich-Text settings
  $hasRichText = 0x8 & ord($subData[0]) >> 3;

  // offset: 1: size: var; character array
  // this offset assumes richtext and Asian phonetic settings are off which is generally wrong
  // needs to be fixed
  $value = self::_encodeUTF16(substr($subData, 1, $isCompressed ? $characterCount : 2 * $characterCount), $isCompressed);
  return array(
    'value' => $value,
    'size' => $isCompressed ? 1 + $characterCount : 1 + 2 * $characterCount,
  );
}