Skip to content

Commit

Permalink
Use multibyte aware substr when setting newline position
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Ford committed Aug 31, 2021
1 parent 9343a91 commit 4e1360a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Html2Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ protected function _setNewPositionForNewLine($curr = null)
if ($curr !== null && $sub->parsingHtml->code[$this->_parsePos]->getName() === 'write') {
$txt = $sub->parsingHtml->code[$this->_parsePos]->getParam('txt');
$txt = str_replace('[[page_cu]]', $sub->pdf->getMyNumPage($this->_page), $txt);
$sub->parsingHtml->code[$this->_parsePos]->setParam('txt', substr($txt, $curr + 1));
$sub->parsingHtml->code[$this->_parsePos]->setParam('txt', mb_substr($txt, $curr + 1, null, $this->_encoding));
} else {
$sub->_parsePos++;
}
Expand Down

0 comments on commit 4e1360a

Please sign in to comment.