1
dlh
UTF-8 Upgrade Problems
  • 2010/2/10 19:36

  • dlh

  • Posts: 182

  • Since: 2002/2/20


Hey folks,

My site has been with XOOPS since like ver 0.9!

Now, I upgraded from 2.3.3b to 2.4 and have run into a snag with odd characters. At first, I thought "no big deal", since I had forgotten to make the correction in global.php back to my old CHARSET ---->

define('_CHARSET', 'ISO-8859-1');


I did that and nothing happened. Still have character errors in text.

Now I'm scratching my head. I searched forums but my answer did not seem to appear.

Any help welcome please!

http://www.guitargearheads.com


Dan



2
ghia
Re: UTF-8 Upgrade Problems
  • 2010/2/10 23:35

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You did probably some editings while your site was UTF-8. You have to edit and save it again.
Check your mainfile.php charset also. It has probably to be latin1 as is your database tables collation.

3
MrTang
Re: UTF-8 Upgrade Problems
  • 2010/2/11 3:51

  • MrTang

  • Just popping in

  • Posts: 23

  • Since: 2009/12/4


$db mysql_connect('localhost','user','password');
if(!
$db) echo "Cannot connect to the database - incorrect details";
mysql_select_db('database'); $result=mysql_query('show tables');
while(
$tables mysql_fetch_array($result)) {
foreach (
$tables as $key => $value) {
mysql_query("ALTER TABLE $value COLLATE utf8_general_ci");
}}
echo 
"The collation of your database has been successfully changed!";
?>

I used that before to change all my tables to UTF8, save going through each table.
Can change it to anything I suppose.
make the php file, call it what you want, i used change.php.
upload,call it in browser and run it.
Make sure you back up before you try in case you mess up.
Worked first time for me np.
Dont know any more then that, im sure other will advise if this good or bad idea.

4
ghia
Re: UTF-8 Upgrade Problems
  • 2010/2/11 8:31

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I think dlh its database is latin and that he simply needs to stay with its site as ISO, but its global.php got wrong configured to UTF-8.

The routine you offer has some potential problems!
Many databases have latin as their character set, but contains in fact a windows character set, which is more extended. These extra characters as eg the euro sign are not translated and stay as non UTF-8 characters in the database.
Additional corrections are needed to rectify that.

I think the query is not correct syntax and should be:
mysql_query("ALTER TABLE $value CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci");

Login

Who's Online

174 user(s) are online (52 user(s) are browsing Support Forums)


Members: 0


Guests: 174


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits