Problem with HTML and MYSQL accentuation

Asked

Viewed 676 times

1

I’m having a lot of issues with accentuation, first of all, I’m using WAMP Server. The charset of my site is as UTF-8, that’s why the ISO-xxx... simply uncouples the whole accent of the HTML page, anyway, I have two Fields in Mysql with accentuation that were inserted from a form of my site and this was the result: https://docs.google.com/file/d/0Bx3aT2W0xcIpcWVHbkx4YjQwcmc/edit?usp=docslist_api

On my website to "echo" these Fields in an editing form this is the result: https://docs.google.com/file/d/0Bx3aT2W0xcIpSWhmSS10YmlMcTQ/edit?usp=docslist_api As you can see the accentuation errors are gone.

These are the collations of these Fields: https://docs.google.com/file/d/0Bx3aT2W0xcIpTXlQUUxFalpqRW8/edit?usp=docslist_api

Any idea how to kill this bug?

  • 1

    Ever tried to use latin1_general_ci?

  • No, I will try.

  • Ultilizando UTF como Ncode vai assim para o banco, unless you use mb_encoding to save to the bank, but later when displaying the regions you will have to use reverse mb_encoding

  • 1

    Rene Sá, your suggestion worked. Thanks.

1 answer

2


Before importing the data into your Mysql database, set a standard collation. In Brazil Latin1 is the most used, so the standard CHARSET (character encoding) is Latin1 and the standard COLLATE (collation) is the latin1_general_ci. External scripts may use UTF8 and it is usually because of the difference of encoding between Latin1 and UTF8 that accentuation errors occur.

ALTER DATABASE `sua_base` CHARSET = Latin1 COLLATE = latin1_swedish_ci;

OR

ALTER DATABASE `sua_base` CHARSET = UTF8 COLLATE = utf8_general_ci;
  • (Someone has to answer)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.