artesaos / seotools

SEO Tools for Laravel
MIT License
3.11k stars 503 forks source link

UTF-8 characteres not showing correctly #122

Closed siempay closed 5 years ago

siempay commented 6 years ago

I am using this SEOMeta::setDescription("les entreprises dans leur quête de performance, grâce à ses solutions d’amélioration de la qualité de vie et de fidélisation des salariés");

but I get this in page source code: <meta name="description" content="les entreprises dans leur qu&ecirc;te de performance, gr&acirc;ce &agrave; ses solutions d&rsquo;am&eacute;lioration de la qualit&eacute; de vie et de fid&eacute;lisation des salari&eacute;s">

reasecret commented 6 years ago

Same here...

siempay commented 6 years ago

@reasecret, the problem looks like it is coming from this {!! SEO::generate() !!}. this displays HTML Code in blade but it parse the non-UTF8 characters So a better way is to change this {!! SEO::generate() !!} to {!!html_entity_decode(SEO::generate())!!}

reasecret commented 6 years ago

I've removed htmlentities function from SEOMeta.php (on line 254). Now looks like no problem for me.

siempay commented 6 years ago

dose'nt it should stay there ?

serdarkok commented 6 years ago

For Solutions:

/vendor/artesaos/seotools/SEOMeta.php Line: 254 $this->description = (false == $description) ? $description : strip_tags(htmlentities($description)); change this: $this->description = (false == $description) ? $description : strip_tags(html_entity_decode($description));

/vendor/artesaos/seotools/OpenGraph.php Line: 834

return $this->addProperty('description', htmlentities($description));

change this: return $this->addProperty('description', html_entity_decode($description));

/vendor/artesaos/seotools/TwitterCards.php Line: 136

return $this->addValue('description', htmlentities($description));

change this:

return $this->addValue('description', html_entity_decode($description));

StApostol commented 5 years ago

@reasecret, the problem looks like it is coming from this {!! SEO::generate() !!}. this displays HTML Code in blade but it parse the non-UTF8 characters So a better way is to change this {!! SEO::generate() !!} to {!!html_entity_decode(SEO::generate())!!}

I did as you suggested just added a flag ENT_NOQUOTES

klimov-paul commented 5 years ago

PR: #159