tags:

views:

18

answers:

1

Hi All,

I was wondering if anyone had experience of trying to get Eth to enter into a mysql database properly at all? I have a simple html form, processed using PHP4 code which stores the data in mysql, but i want to allow users to be able to use characters such as Ð, æ, ö and the like. I have tried different collations such as latin1 and utf8_unicode_ci but none seem to want to accept them properly, I either get a question mark or completely different characters.

MySQL: 5.1.30
phpMyAdmin: 3.2.4
default charset: utf8
php charset: utf8

Any help would be most appreciated. Even if it is just to say it can't be done. I realise there is a chance i can't cover for all possible characters, but until someone says "No!", then i live in hope ;)

+1  A: 

SET NAMES utf8 query at first and then check your table character set and pages character set if problem persists

there are three main section in your application encoding:

  • HTML page encoding. set by Content-type HTTP header
  • db table encoding. set by table definition
  • db client (PHP) encoding. set by SET NAMES query

Check all three parts to have proper encoding and you'll never have any problem

Col. Shrapnel
aha!on my DB connection i have now added: mysql_set_charset('utf8',$conn);and that seems to have worked perfectly! My page was already declared as utf8, and the mysql database is utf by default. so it was just that final piece of the trilogy i was missing. thank you so much!
Paul S