laravel-dompdf
laravel-dompdf copied to clipboard
Malformed UTF-8 characters, possibly incorrectly encoded
why keep getting this error message (Malformed UTF-8 characters, possibly incorrectly encoded) even that i've set my blade meta charset ( ), and i can see in the request header that the encoding method is UTF_8, i did install the package correctly, why is that hapening and how can i solve that.
try this return response()->streamDownload(function () use ($pdf) { echo $pdf->stream(); }, 'name.pdf');
try this return response()->streamDownload(function () use ($pdf) { echo $pdf->stream(); }, 'name.pdf');
it works for me thank you, but i wish if you could tell me what was the problem
Any explanation on why the problem occurred? @TigselemaAlex
bytes vs raw text
Any explanation on why the problem occurred? @TigselemaAlex
I'm not a Laravel expert, but I think it's because it's trying to show in a view the pdf data stream and that's why this error occurs. The only solution I found was that.
try this return response()->streamDownload(function () use ($pdf) { echo $pdf->stream(); }, 'name.pdf');
Its worked for me.But not showing svg files.
It worked for me too. But, it would be nice for the error to be handled directly a lib.
It's April 2024 I still got tripped by this issue.
I confirm that the solution posted by @TigselemaAlex works but as @themegazord said, it would be nice to have this fixed in the lib.
"barryvdh/laravel-dompdf": "2.1.1"
PHP Version
8.2.x
Laravel Version
10.48.4
Alpine Version
3.13.8
Theme
Tailwind 3.x
try this return response()->streamDownload(function () use ($pdf) { echo $pdf->stream(); }, 'name.pdf');
Bro thanks a lot you saved my life <3
facing the same problem, @TigselemaAlex solution work ! genius.