PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 8, 2022

[FIXED] Dompdf UT8 with database records with accents

 March 08, 2022     dompdf, laravel     No comments   

Issue

I have a problem with utf8 with my stored data with dompdf for laravel: https://github.com/barryvdh/laravel-dompdf

My column collation is set to

utf8mb4_unicode_ci

In my html file I use:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

So when I write in my html file : éééé and I generate the PDF it's file but when I display my stored data the accents are displayed by : ?

enter image description here

In my config/dompdf.php

I have set :

  "DOMPDF_UNICODE_ENABLED" => true,
  "DOMPDF_PDF_BACKEND" => "CPDF",

What am I doing wrong? The problem only come from my stored data.. Hope someone could help thanks a lot in advance.

When I display my blade page without dompdf on firefox it's also really strange I get spaces between the accents :

enter image description here

But with Chrome all is fine ..

enter image description here

Also when i trie to pass a variable with a accent to my dompdf view the content of the variable is not display when there is an accent

$fede = 'fé'; // not display 
$fede = 'fe'; // is displayed as well.. 

Solution

I had same issue before , and i changed many things but i couldn't make it to work , then i switched to niklasravnsborg/laravel-pdf and it worked like sharm , give it a try and see



Answered By - BM2ilabs
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing