PHP coding problem, character error in PDF file

2

Well, I have a problem that is not very unusual, I've seen some similar questions and none of the answers helped me.

I have an HTML form where the information in it is being captured via POST by PHP , so far so good. To save this data as PDF I am using the mPDF 6.0 library. I'm basically using an HTML page as a pro PDF template and the information gets PHP is replaced in the template.

The error is that the data that was taken by PHP can not have accents or "ç" since they appear strange, but this does not happen with HTML , then I have a part of PDF with correct emphasis that the template page in HTML and what comes from PHP does not accept accent. p>

Example of what happens:


NotethatyouhaveanHTMLaccentwithoutanyproblemsandthePHPpartoftheerrorhappens.

SomethingsI'vetried:

PlacetheHeaderinPHP:header('Content-Type:text/html;charset=utf-8')

InHTMLfilesthegoalutf8:metacharset="utf-8"

Save the files in UTF-8 , everyone is already like this.

And finally I tried this conversion that does not make much sense but it was a suggestion I saw in some answers: $pdf = mb_convert_encoding($pdf, 'UTF-8', 'UTF-8');

Without success, the problem continues even though everything is UTF-8.

Codes:

         Fomulário

<body>
    <form method="POST" action="pdf/index.php" enctype="multipart/form-data" onsubmit="return checkFile();">

        Número de Protocolo:<input type="text" name="f_protocolo" id="protocol"> Marca para Registro:<input type="text" name="f_registro">

    </form>
</body>

Template:

      

    

    <div>

        <p>Número de protocolo: #f_protocolo</p>


        <p>Marca para registro: #f_registro</p>

    </div>
</fieldset>

PHP:

If anyone has an idea of what might be happening, I accept suggestions.

Thank you in advance.

    
asked by anonymous 09.08.2017 / 14:03

0 answers