Accents do not appear with PHP

1

I am making a certificate system for an event and when words are inserted with accents, they bug. I am using Laravel and a library called Intervention Image to generate the images of the certificates and add texts in the spaces left in the image. After the image is generated, a PDF is created.

The following is the certificate image:

Asshowninthefigure,accentsarenotbeinginserted.HomeBelowisthecodeinwhichthetextsareplaced.

$img=Image::make(public_path().'/imagens/certificado.jpg');//NOME$img->text($usuario->name,800,320,function($font){$font->file(public_path().'/font/Asimov.otf');$font->size(60);$font->align('center');$font->color('#000000');});//CPF$img->text($usuario->cpf,310,383,function($font){$font->file(public_path().'/font/Asimov.otf');$font->size(18);$font->align('center');$font->color('#000000');});//TIPOATIVIDADE$img->text('Organizacão',640,383,function($font){$font->file(public_path().'/font/Exo-Regular.otf');$font->size(18);$font->align('center');$font->color('#000000');});//NOMEATIVIDADE$img->text('Comissãoorganizadora',1060,383,function($font){$font->file(public_path().'/font/arial.otf');$font->size(18);$font->align('center');$font->color('#000000');});//TIPO$img->text('Organizador(a)',670,413,function($font){$font->file(public_path().'/font/Asimov.otf');$font->size(19);$font->align('center');$font->color('#000000');});//HORAS$img->text('40',945,413,function($font){$font->file(public_path().'/font/Asimov.otf');$font->size(19);$font->align('center');$font->color('#000000');});//MINUTOS$img->text('00',1010,413,function($font){$font->file(public_path().'/font/Asimov.otf');$font->size(19);$font->align('center');$font->color('#000000');});//AUTENTICIDADE$img->text('AautenticidadedessecertificadopodeserverificadapelaURL:',362,1030,function($font){$font->file(public_path().'/font/Asimov.otf');$font->size(19);$font->align('center');$font->color('#ffffff');});$file='www.feiradascidades.canoas.ifrs.edu.br/validar/certificadocomissao'.$usuario->id;//URL$img->text($file,392,1050,function($font){$font->file(public_path().'/font/Asimov.otf');$font->size(19);$font->align('center');$font->color('#ffffff');});$caminho[$key]=public_path().'/imagens/certificadocomissao'.$usuario->id.'.jpg';$img->save(public_path().'/imagens/certificadocomissao'.$usuario->id.'.jpg');'

ThisgeneratorwasmadevialocalhostonWindows,butishostedonaLinux-basedserver.DuringdevelopmentonWindows,theaccentsworkedperfectlyandafterthehostingfailed.


TheheaderofallHTMLfilesarewithcharsetsettoUTF-8,andintheclassImounttheimage(codeabove),%p>

Whenyourunthefollowing

ini_set('default_charset','UTF-8');dd(ini_get('default_charset'));

Thisisaresultofthis

In fact the charset is set to UTF-8, but the words continue without an accent. I tried numerous things to solve, but so far unsuccessful.

EDIT: Home Looking better, the data arrives in UTF-8, checked by ini_set('default_charset', 'UTF-8'); . Apparently the problem is saving the image because it's already saved with the accent problem. I think the problem is this part:

$img->save(public_path().'/imagens/certificadocomissao'.$usuario->id.'.jpg');
    
asked by anonymous 07.03.2017 / 19:38

0 answers