Page 1 of 1

how to change charecter set of database at runtime

Posted: Thu Jun 11, 2009 7:40 am
by sivaji
hi, to all
i am developing multilingual site in that site i have an option change language...there i am storing all static words in database ...when i am going to change language... i am facing umlaut problems for german characters.. pls suggest me is it possible to change character set of database at run time..if it is possible pls pls explain me thank u all...............

Re: how to change charecter set of database at runtime

Posted: Fri Jun 12, 2009 11:23 am
by Popcorn
i think you need the entire sequence of connections to be in an encoding that can handle umlauts. i just made *everything* UTF-8.

to fetch tho, i'd say make sure:
1) the db table is in UTF-8.
2) you have to make sure the connection between PHP and the db is good enough. in PHP, after you connect (but before you transfer over the connection) make PHP execute "SET NAMES 'utf8';" (i assume MySQL) on the db.
3) then when your PHP prints the page, make sure that you set in the <head> of the HTML that the page is in UTF-8 so the browser knows how to deal with the characters.

think that's about it.