Reply to PHP & Unicode

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация