Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TcPpdfOutput and FpdfOutput do not support full utf-8 character set #131

Open
onebeat opened this issue Jun 7, 2021 · 7 comments
Open
Labels
bug Something isn't working help wanted Extra attention is needed support Support & help

Comments

@onebeat
Copy link

onebeat commented Jun 7, 2021

Hello, i am using tcpdf as output option. Here is my code

$tcPdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8');
$tcPdf->setPrintHeader(false);
$tcPdf->setPrintFooter(false);
$tcPdf->AddPage();
$output = new QrBill\PaymentPart\Output\TcPdfOutput\TcPdfOutput($qrBill, 'en', $tcPdf);
$output->setPrintable(false)->getPaymentPart();

Originally posted by @onebeat in #130 (comment)

@onebeat onebeat changed the title Hello, i am using tcpdf as output option. Here is my code tcpdf UTF8 problem Jun 7, 2021
@sprain sprain added the support Support & help label Jun 7, 2021
@sprain
Copy link
Owner

sprain commented Jun 7, 2021

Please show us your result, too. Where and how does the utf8 issue appear?

@onebeat
Copy link
Author

onebeat commented Jun 7, 2021

Hello, you can see it on pdf which i have uploaded...
qrbill-issue.pdf

@sprain
Copy link
Owner

sprain commented Jun 8, 2021

Thank you for the example.

I can confirm that TcPdfOutput and to some extent FpdfOutput do not fully support the utf8 charset. It works for characters like é, but others like ł or ą are displayed as ?.

Based on a quick Google search, this seems to be a widespread issue. It is discussed here, for instance.

Maybe @sdespont or @Franco2911 know how to fix this issue?

@sprain sprain added the bug Something isn't working label Jun 8, 2021
@sprain sprain changed the title tcpdf UTF8 problem TcPpdfOutput and FpdfOutput do not support full utf-8 character set Jun 8, 2021
@sprain sprain added the help wanted Extra attention is needed label Jun 8, 2021
@onebeat
Copy link
Author

onebeat commented Jun 8, 2021

Hello, i have solved issue with help of your link and my trying to digg up the part of code where QRbill uses fonts definition..

  1. download file on link here
  2. /path/to/tcpdf/tools/tcpdf_addfont.php -i /path/to/fonts/ArialUnicodeMS.ttf
  3. go to TcPdfOutput.php on line 25 then change to ArialUnicodeMS
  4. problem solved
  5. it would be greate to integrate in construct to change dynamic font

@KamilPesek
Copy link

As mentioned above, this is a problem of TcPpdf/Fpdf and ISO-8859-1 encoding. When usign TCPDF, the easiest is to set
private const FONT = 'dejavusans'; in
src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php:25

Just keep in mind that if you are using composer that you can't change it directly in vendor folder. Make own copy of it.

@sprain
Copy link
Owner

sprain commented Jun 16, 2021

Just keep in mind that if you are using composer that you can't change it directly in vendor folder. Make own copy of it.

Or you provide a pr to fix it for good within this library 😉

@KamilPesek
Copy link

Just keep in mind that if you are using composer that you can't change it directly in vendor folder. Make own copy of it.

Or you provide a pr to fix it for good within this library 😉

Totally agree. If there will be time, I will look at it.

KamilPesek pushed a commit to KamilPesek/php-swiss-qr-bill that referenced this issue Jul 20, 2021
KamilPesek added a commit to KamilPesek/php-swiss-qr-bill that referenced this issue Jul 20, 2021
KamilPesek added a commit to KamilPesek/php-swiss-qr-bill that referenced this issue Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed support Support & help
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants