[Gambas-user] Problem with UTF-8 in Gambas-connection to MySQL

Dima Malkov dima.malkov.russia at ...626...
Sat Sep 12 10:20:35 CEST 2009


(I don't know English well)
Use Debian 5 "Lenny" -32, Gambas 2.7 from repository.

I develop an account program for russians users. It must work with cyrillic
correct.
I have made MySQL5 (default UTF8) database with direct CHARACTER SET UTF8
option, tables with direct CHARACTER SET UTF8 option. Then connected to it
from gambas, output data to GridView. All string fields were not readable.

I run example "Database". It works correct with some french symbols, but
with cyrillic not. Program "Database manager" do the same.

I get sources of Gambas-2.8.2. Opened main.c file of MySQL driver, find
function
  <<< static int open_database(DB_DESC *desc, DB_DATABASE *db) >>>.
Add string
  <<< fprintf(stderr, "Character set GB[%s] mysql[%s]\n",
GB.System.Charset(), mysql_character_set_name(conn)); >>>
before and after string
  <<< set_character_set(db); >>>.
Compiled only this driver, copied it to /usr/lib/gambas2. Run my program.
Result:
  <<< Character set GB[UTF-8] mysql[latin1]
         Character set GB[UTF-8] mysql[latin1] >>>
in console.

Why latin1 instead UTF-8?



More information about the User mailing list