| | |
Multilanguage with PHP-MySQL
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 42
Reputation:
Solved Threads: 0
Hi there,
I'm building a multilanguage CMS based Web site using PHP 5- MySQL and I'm facing problems with languages.
From what I've been reading I must use charset UTF-8 (as Wikipedia uses this I guess this is realy the right choice).
Now, I must also know how to store different languages in a MySQL table - possible? How do I do it?
So far I haven't succeeded storing anything different character there, not even a simple รง.
Please, any hints? I'm getting desperate here..
Thank you!
I'm building a multilanguage CMS based Web site using PHP 5- MySQL and I'm facing problems with languages.
From what I've been reading I must use charset UTF-8 (as Wikipedia uses this I guess this is realy the right choice).
Now, I must also know how to store different languages in a MySQL table - possible? How do I do it?
So far I haven't succeeded storing anything different character there, not even a simple รง.
Please, any hints? I'm getting desperate here..
Thank you!
•
•
Join Date: Mar 2008
Posts: 42
Reputation:
Solved Threads: 0
Well, 8 hours ago I posted this desperately in need of an answer. Yes, it's Sunday, but one's got to work hard if he wants to get somewhere faster... No one replied... but... I've found the solution...
Putting in simple terms:
1. Your forms must be coded in UTF-8
2. The pages where you want to display multilanguage text too.
This means you MUST use this:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3. Your MySQL table MUST be coded as utf8_general_ci
Surprisingly, this is not enough and this is what was driving me nuts...
4. So, to fix this, you must use this before issuing the sql commands:
$defineutf = "SET NAMES 'utf8";
$utf = mysql_query($defineutf);
This is the article that saved my day:
http://www.shawnolson.net/a/946/unic...-mysql-41.html
Putting in simple terms:
1. Your forms must be coded in UTF-8
2. The pages where you want to display multilanguage text too.
This means you MUST use this:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3. Your MySQL table MUST be coded as utf8_general_ci
Surprisingly, this is not enough and this is what was driving me nuts...
4. So, to fix this, you must use this before issuing the sql commands:
$defineutf = "SET NAMES 'utf8";
$utf = mysql_query($defineutf);
This is the article that saved my day:
http://www.shawnolson.net/a/946/unic...-mysql-41.html
Last edited by marcosjp; Jan 4th, 2009 at 9:38 pm.
![]() |
Other Threads in the PHP Forum
- Previous Thread: Website to CSV
- Next Thread: [HELP] Regarding on select Box
| Thread Tools | Search this Thread |
Tag cloud for PHP
# .htaccess 5.2.10 access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display dissertation download dynamic echo email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link login loop mail menu mlm mod_rewrite multiple mysql mysqlquery oop open parse paypal pdf persist php problem query radio random recursion regex remote script search server sessions sms soap sockets source space sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube





