I\'m trying to work with French characters. For whatever reason, PHP won\'t output them correctly unless I force the ISO-8859-1 character set (which I really don\'t
Please, besides the database encoding, be sure you check the following:
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
SET character_set_connection = 'utf8'
ALTER TABLE table CONVERT TO CHARACTER SET utf8;
SET character_set_results = 'utf8'
SET character_set_client = 'utf8'
SET character_set_database = 'utf8'
and SET character_set_server = 'utf8'
charset=utf-8
, so ultra edit or your favorite editor can detect it. rgds.
basic; has your .php file the line on top?
header("content-type:text/html;charset=utf8\n");
I have run into the same issue, but I would suggest:
$array = htmlentities($array);
$json = json_encode($array);
I managed to figure it out. It's not really the solution I wanted but it works. I had to adjust my query to look like:
CONVERT(CAST(langselect as BINARY) USING latin1) as langselect
Try to work on sources directly in utf8.
I was faced with the same problem, and used this simple solution: When you create a new PHP or Javascript source file, ensure it is encoded in utf8. I use Ultra Edit, and chose the option “UTF8 no bom”. This simple step resolved all my problems with encoding characters.
All modern browsers support utf8, so encode your webpages with this. For compatibility, it is simpler if all your source files are also in utf8.
This follows web standards.