Problems with accents when uploading text from ckeditor to mysql

0

I have gone crazy looking for a solution to a problem that arose with the collation of characters. Pecking through the forums here and there; I have managed to find the solution and I would like to share it in case anyone could come in handy. The problem was:

Through a form using ckeditor, a text that could have accents or other characters was uploaded to the database. From another page the database was read and a PDF was returned. The result is that I returned the pdf with strange characters or with the html expression of the accented vowels. I have solved it in the following way:

First I have encrypted everything, pages and database in UTF-8.

To the variable that collects the text of the ckeditor and then uploads to the database I have given the following treatment:

$ puntotexto grande = $ _POST ['editor1']; $ puntotextogrande = html_entity_decode ($ puntotexto grande, ENT_QUOTES | ENT_HTML401, "UTF-8");

With this I have managed to keep the accents in the database and not the html codes returned by the ckeditor.

On the page where the PDF is formed, to the variable that collects the data from the database, I gave it the following treatment:

$ content = iconv ('utf-8', 'windows-1252', $ content);

With this the pdf will be formed with the accents correctly.

I hope I can help someone ... and thanks to everyone who writes in the forums. Although I did not find the direct answer ..., based on composing between the ideas of one and others, I managed to solve the problem.

    
asked by carlos 15.05.2018 в 19:58
source

0 answers