I have database table as follows:
CREATE TABLE `tbl_jobs` (
`job_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`job_title` VARCHAR(100) NOT NULL,
`job_salary` VARCHAR(150) NULL DEFAULT NULL,
`job_desc` TEXT NOT NULL,
PRIMARY KEY (`job_id`),
COLLATE='utf8_general_ci'
ENGINE=InnoDB
In one of the records I have the salary stored as €30,000 plus excellent benefits
so in the webpage it should render as €30,000 plus excellent benefits
. As you can see €
is a valid utf8 character.
My database connection is as follows:
`mysql:host=myhost;dbname=mydatabase;charset=utf8`
I have the following meta tag in the head section of my webpage:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
However on the webpage it is still rendering as €30,000 plus excellent benefits
. If I change the connection charset to latin1
as follows it renders correctly.
`mysql:host=myhost;dbname=mydatabase;charset=latin1`
Why is it behaving like this considering it is utf8 character?