Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Commit

Permalink
Bugfix: (teso) Work item 18551 - Rich Text containing UTF-8 character…
Browse files Browse the repository at this point in the history
…s creating unreadable content with Excel5 Writer
  • Loading branch information
Mark Baker committed Dec 11, 2012
1 parent bf25875 commit 62bf1b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Classes/PHPExcel/Shared/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,10 @@ public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array())
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
}
else {
$data = pack('vC', $ln, 0x08);
$data = pack('vC', $ln, 0x09);
$data .= pack('v', count($arrcRuns));
// characters
$data .= $value;
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
foreach ($arrcRuns as $cRun){
$data .= pack('v', $cRun['strlen']);
$data .= pack('v', $cRun['fontidx']);
Expand Down
4 changes: 2 additions & 2 deletions Classes/PHPExcel/Writer/Excel5/Worksheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ function close()
if ($cVal instanceof PHPExcel_RichText) {
// $this->_writeString($row, $column, $cVal->getPlainText(), $xfIndex);
$arrcRun = array();
$str_len = strlen($cVal->getPlainText());
$str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8');
$str_pos = 0;
$elements = $cVal->getRichTextElements();
foreach ($elements as $element) {
Expand All @@ -437,7 +437,7 @@ function close()
}
$arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
// Position FROM
$str_pos += strlen($element->getText());
$str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8');
}
$this->_writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
} else {
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Fixed in develop branch:
- Bugfix: (MBaker) Work item 18844 - cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't
- Bugfix: (Progi1984) Work item GH-22 - Sheet View in Excel5 Writer
- Bugfix: (amironov) Work item GH-82 - PHPExcel_Worksheet::getCellCollection() may not return last cached cell
- Bugfix: (teso) Work item 18551 - Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer


--------------------------------------------------------------------------------
Expand Down

0 comments on commit 62bf1b7

Please sign in to comment.