views:

32

answers:

3

I have formatted english text stored in mysql. When I echo it out with php, I get a whole a lot of "� � � � � ���" instead of where spaces should be. It looks fine in the DB.

Whats the reason for that?

A: 

That will most likely have to do with either your database has a conflicting character set to that of your html document, or your server is pushing out the wrong character encoding for your html document.

Ben Rowe
The most insane thing is that it outputs the text just fine in one php file, and not in another.
Yegor
Check your html encoding...
Garis Suero
what is your mysql Collation set to?
Ben Rowe
utf8_general_ci for that particular column.
Yegor
A: 

if your characters looks OK in your DB: Try setting this php/html output-encode to the same encode you have in your DB...

What characters are? speaking language?...

Garis Suero
Yes, it looks okay. Its in English.
Yegor
A: 

I have come across this problem before and what I have done is set the db and column collation to *utf8_general_ci*. And between my tags put the below meta line in.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Then I ran this query when I open my db connection: mysql_query("SET NAMES 'utf8'");

This helped me with multilingual websites quite a bit :-)

PHPology
Actually removing this made it work. lol
Yegor