Bugfix: (teso) Work item 18551 - Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer

This commit is contained in:
Mark Baker 2012-12-11 17:54:23 +00:00
parent bf2587546e
commit 62bf1b7a93
3 changed files with 5 additions and 4 deletions

View File

@ -443,10 +443,10 @@ class PHPExcel_Shared_String
$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']);

View File

@ -424,7 +424,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
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) {
@ -437,7 +437,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$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 {

View File

@ -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
--------------------------------------------------------------------------------