Skip to content

Commit

Permalink
show correct error on incorrect encoding
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Barkow-Kuder <github@r.z11.de>
  • Loading branch information
rubo77 committed Mar 7, 2023
1 parent 2fb1c01 commit ab5fe4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/tcpdf_fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,11 @@ public static function UTF8StringToArray($str, $isunicode, &$currentfont) {
if ($isunicode) {
// requires PCRE unicode support turned on
$chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY);
$carr = array_map(array('TCPDF_FONTS', 'uniord'), $chars);
if(empty($chars)){
die('TCPDF Error: Incorrect encoding: '.$str);
}else{
$carr = array_map(array('TCPDF_FONTS', 'uniord'), $chars);
}
} else {
$chars = str_split($str);
$carr = array_map('ord', $chars);
Expand Down

0 comments on commit ab5fe4d

Please sign in to comment.