crabbly / fpdf-laravel

A package for Laravel to implement the FPDF class.
Other
30 stars 8 forks source link

Language Problem #7

Closed lokutus24 closed 4 years ago

lokutus24 commented 4 years ago

Hello,

how can i set language? i have Problem with accent. How can i fix this Problem?

Regards, Gabor

crabbly commented 4 years ago

Hey @lokutus24,

Looks like this is a common issue with FPDF. Found this in the official documentation page:

3. Accented letters are replaced with some strange characters like é.

Don't use UTF-8 with the standard fonts; they expect text encoded in ISO-8859-1 or windows-1252. You can use utf8_decode() to perform a conversion to ISO-8859-1:
$str = utf8_decode($str);
But some characters such as Euro won't be translated correctly. If the iconv extension is available, the right way to do it is the following:
$str = iconv('UTF-8', 'windows-1252', $str);
In case you need characters outside windows-1252, take a look at tutorial #7 or tFPDF.

Take a look at the FPDF documentation page for info: http://www.fpdf.org