PCoelho
PCoelho

Reputation: 8010

Mysql encoding not consistent

I am portuguese and I am making a website that has vegetable names.

However, the encoding its not consistent. For example the word Agrião (watercress) sometimes comes out correctly but other times it comes out like Agrião.

As I refresh the page it picks one of them by random. Sometimes it's correct, sometimes it's not.

Upvotes: 1

Views: 69

Answers (1)

Ja͢ck
Ja͢ck

Reputation: 173522

There can be a few factors:

  1. MySQL columns / tables are not using the right encoding (UTF-8 is recommended)
  2. The database session character set is not set properly (SET NAMES utf8 [mysql_set_charset() for the deprecated API])
  3. The page encoding is wrong (header('Content-Type: text/html; charset=utf-8'))

Upvotes: 1

Related Questions