p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP Databases (http://p2p.wrox.com/forumdisplay.php?f=97)
-   -   Character code (http://p2p.wrox.com/showthread.php?t=87631)

mike_abc May 28th, 2012 08:38 AM

Character code
 
Hi,

I have records in my MySQL database which are in Romanian, where such characters as ă, î, â, ș, ț appear. The database was created with the statement

Code:


CREATE DATABASE <db_name> DEFAULT CHARACTER SET utf8 COLLATE utf8_romanian_ci;

and, as you'd expect, there's no problem with the Romanian characters (e.g. in the MySQL utility).
However, in PHP generated HTML, I get rogue characters instead of the correct ones after a SELECT... query.

What can I do to get correct characters ?

On the Internet, someone suggested to have a "SET CHARACTER SET utf8;" directive before the query.
Well, it seemed to work for some queries (or the first in a row), but I still get rogue chars in a PHP script where I have multiple subsequent queries.


Thanks,

Mike


All times are GMT -4. The time now is 05:24 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.