Author Topic: utf8 and mysql 4.1  (Read 6699 times)

0 Members and 1 Guest are viewing this topic.

Offline fabio

  • Newbie
  • *
  • Posts: 36
    • View Profile
utf8 and mysql 4.1
« on: February 03, 2007, 10:41:25 AM »
hello all

i`m trying to set 4images
and everything goes smooth apart from one thing

the site`s encoding is utf8 ((et in the lang file) and the db tables have utf8_genereal collation

the text is saved in the database in this form σαφασφδ
in most cases the text appears correctly (but not  in the search strings)

i fould that i need to add this
@mysql_query('set character set utf8');
@mysql_query("SET NAMES 'utf8'");

just after the conection to the db.

can anyone tell where this is done or if i`m wrong about the solution could you point me to the correct direction?


thanks

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: utf8 and mysql 4.1
« Reply #1 on: February 03, 2007, 05:14:41 PM »
you need to update the table encoding in order to use utf8 in your 4images tables,
in order to do that you have to run the following SQL for every table

Code: [Select]
ALTER TABLE table_name CHARACTER SET utf8
Where "table_name" is the name of your table, f.e. "4images_users"

Offline fabio

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: utf8 and mysql 4.1
« Reply #2 on: February 04, 2007, 08:23:14 AM »
thanks for the reply

i`ve already done than but instead of utf8 i used utf8_general  which didn`t work

so i tried your way and the same happened

i created a category by the name τεστ
and in the cat table it appears as     τεστ κατα

changing only the table`s collation is not enough.... the queries i mentioned a needed but i don`t know where i should put them ...



Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: utf8 and mysql 4.1
« Reply #3 on: February 04, 2007, 04:29:17 PM »
well, did you change your language settings in your phpMyAdmin to your language? I had that issue a while ago, but i remember fixing it that way

Offline fabio

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: utf8 and mysql 4.1
« Reply #4 on: February 05, 2007, 05:48:46 PM »
done that too.

in the same db are the tables of another php script which works perfect
i`ve compared the tables and they have the same settings (regarding languages)

the only difference i can think of is the "missing" two queries

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: utf8 and mysql 4.1
« Reply #5 on: February 05, 2007, 06:45:56 PM »
"missing"??
Try to run installation again ...

Offline fabio

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: utf8 and mysql 4.1
« Reply #6 on: February 10, 2007, 05:20:40 PM »
after a lot of try`n`errors i added in two places in includes/db_mysql.php
the beforementioned queries

@mysql_query('set character set utf8');
@mysql_query("SET NAMES 'utf8'");

1)in function Db before tne return
2)in  function query after  unset($this->query_id);