943,948 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 2124
  • PHP RSS
Jan 4th, 2009
0

Multilanguage with PHP-MySQL

Expand Post »
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!
Reputation Points: 10
Solved Threads: 0
Light Poster
marcosjp is offline Offline
42 posts
since Mar 2008
Jan 4th, 2009
0

Re: Multilanguage with PHP-MySQL

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
Last edited by marcosjp; Jan 4th, 2009 at 9:38 pm.
Reputation Points: 10
Solved Threads: 0
Light Poster
marcosjp is offline Offline
42 posts
since Mar 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Website to CSV
Next Thread in PHP Forum Timeline: [HELP] Regarding on select Box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC