I have some really strange problem. I have a MySQL database and a sample php page (I'm working with CakePHP if this information can help to solve the problem). When I select from the database and print the information on the screen I get something like - "??????". The fields in the database are with collation "utf8_general_ci" like the whole tables and the whole database. The php/html document have "" and there are still "??????" what can I do to solve my problem and view the text in the language I want?
4
-
how about showing us the code you are using to save this to the db...Nick– Nick2012-10-14 21:04:14 +00:00Commented Oct 14, 2012 at 21:04
-
Are you viewing the page with the correct encoding in your browser?Kirby– Kirby2012-10-14 21:05:46 +00:00Commented Oct 14, 2012 at 21:05
-
"On the screen"? In the browser? In a terminal window? Somewhere else?bmargulies– bmargulies2012-10-14 21:09:42 +00:00Commented Oct 14, 2012 at 21:09
-
I've inserted the entries through the phpmyadmin "Insert" option. I also tried with SQL code like this -> INSERT INTO cities VALUES('','София') and the result was the same. I can see this in php my admin but I can't in the browserBankin– Bankin2012-10-14 21:22:37 +00:00Commented Oct 14, 2012 at 21:22
Add a comment
|
1 Answer
Are you still adding a HTML charset?
<?php echo $html->charset('utf-8'); ?>
In a config.php make sure that is properly encoding. In a config/database.php:
'encoding' => 'utf8'
Or you are using standard latin encoding such as ISO-8859-1:
'encoding' => 'ISO-8859-1'
1 Comment
Bankin
I forgot about the "encoding" property in the cakePHP's database config file. Thanks! : )