2

I have a simple form to insert products in a mysql table but it's not working with accented words.

For example:
If I post the word "Calcao" it shows up but if I post the correct Portuguese word "Calção", it doesn't show.

Can anyone help me setting the encoding/charsets?

I'm running this on localhost with MAMP and I have tried to set Database charset to utf8_general_ci and utf8_swedish_ci but none seem to work.

I have:

  • connection.php that connects to database;
  • add.html that shows the form to insert data;
  • add.php who takes action and validate data;
  • view.php where data will apear.

If I post the word "Calcao" it shows up but if I post the correct Portuguese word "Calção", it doesn't show.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Melopeter
  • 169
  • 1
  • 5
  • 2
    All it takes, is one wrong charset setting in your application - *everything* needs to be the same charset! I have previously written [**an answer about UTF-8 encoding**](https://stackoverflow.com/a/31899827/4535200) that contains a little checklist, that will cover *most* of the charset issues in a PHP/MySQL application. There's also a more in-depth topic, [**UTF-8 All the Way Through**](https://stackoverflow.com/q/279170/4535200). Most likely, you'll find a solution in either one or both of these topics. – Qirel Apr 06 '19 at 16:14
  • I will take a look at those 2 answers. Before I asked I've red a lot of topics but they didn't help me much. Thanks – Melopeter Apr 06 '19 at 16:43

0 Answers0