Thread: Character code
View Single Post
  #1 (permalink)  
Old May 28th, 2012, 08:38 AM
mike_abc mike_abc is offline
Authorized User
Points: 173, Level: 3
Points: 173, Level: 3 Points: 173, Level: 3 Points: 173, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote