From deb5386445a9703fbf2ace6b8d20ca6b349bb641 Mon Sep 17 00:00:00 2001 From: Raphael Rott Date: Mon, 20 Jun 2022 17:54:33 +0200 Subject: [PATCH] Add utf8_decode and utf8_encode to str_pad --- example/rawbt-receipt.php | 2 +- example/receipt-with-logo.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/rawbt-receipt.php b/example/rawbt-receipt.php index 45a4e8fc..c5486bd9 100644 --- a/example/rawbt-receipt.php +++ b/example/rawbt-receipt.php @@ -130,7 +130,7 @@ public function getAsString($width = 48) if ($this->dollarSign) { $leftCols = $leftCols / 2 - $rightCols / 2; } - $left = str_pad($this->name, $leftCols); + $left = utf8_encode(str_pad(utf8_decode($this -> name), $leftCols)); $sign = ($this->dollarSign ? '$ ' : ''); $right = str_pad($sign . $this->price, $rightCols, ' ', STR_PAD_LEFT); diff --git a/example/receipt-with-logo.php b/example/receipt-with-logo.php index 8a99edc9..84c23237 100644 --- a/example/receipt-with-logo.php +++ b/example/receipt-with-logo.php @@ -95,7 +95,7 @@ public function __toString() if ($this -> dollarSign) { $leftCols = $leftCols / 2 - $rightCols / 2; } - $left = str_pad($this -> name, $leftCols) ; + $left = utf8_encode(str_pad(utf8_decode($this -> name), $leftCols)); $sign = ($this -> dollarSign ? '$ ' : ''); $right = str_pad($sign . $this -> price, $rightCols, ' ', STR_PAD_LEFT);