| | |
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 |
.htaccess action ajax apache api array auto beginner binary bounce broken cakephp checkbox class cms code cron curl database date display dynamic echo email error errorlog file files folder form format forms function functions google href htaccess html image include insert integration interactive ip java javascript joomla limit link login loop mail malfunctioning masterthesis menu mlm mod_rewrite multiple mysql nodes oop paypal pdf php popup problem query radio ram random recursion reference regex remote return script search server sessions sms soap source space sql syntax system table tutorial unset update upload url validation validator variable video web websitecontactform xml youtube





