|
Posted by slavi.marinov on 10/24/05 15:39
Hello all,
I have a simple question on PHP and the way it handles strings.
Let's say I have a database and a php script that communicates with the
database. The database has some kind of character encoding - let's say
UTF-8, UTF-16, or something different.
When I select some string from the database, for example:
$res = mysql_query("SELECT movie_name FROM my_table");
$row = mysql_fetch_row($res);
echo $row[0];
the database will return the movie_name field in a correctly-encoded
way.
My question is, how do you tell the PHP interpreter what encoding to
use when displaying the text that the mysql queries return? In other
words, will the $row[0] be displayed correctly regardless the database
encoding, provided the database encoding and the HTML <meta> tags are
the same, or do I have to set the PHP encoding in some config file?
What character representation does PHP use when working with strings?
Best Regards,
Slavi
Navigation:
[Reply to this message]
|