I have a mySQL database that contains accented characters that are being displayed incorrectly by a HTML page.

The problem is that I do not trust the encoding that the database is reporting for the tables, because the whole thing was migrated from another server that was failing.

I have tried to convert the characters to several encodings but my problem is identifying the source character encoding.

I have copied a segment of text from the database.

This is the phrase as it should have been displayed

Fóton é uma ferramenta multi-camadas, multi-ní­vel para criar emissores do tipo CAEmitterLayer e partí­culas...

This is how it is being displayed

FÃŗton Ê uma ferramenta multi-camadas, multi-nível para criar emissores do tipo CAEmitterLayer e partículas...

As I see, this is happening:

  • ó is being displayed as Ãŗ
  • ú is being displayed as Ãē
  • â is being displayed as Ãĸ
  • é is being displayed as Ê
  • á is being displayed as ÃĄ

Is it possible to identify the encoding by looking at the text?

  • HTML/Apache/PHP should be configured accordingly. Is this still on the sequence of a previous question you asked here some while ago? What configurations have you for the default encoding for MySQL/PHP/Apache? – Rui F Ribeiro May 2 '17 at 22:12

For simple text you can use tools like:

  • enca,
  • file.

They guess and can verify the encoding of the text.

For MySQL, you can use just simple SQL requests, like it was presented here: [1], [2].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.