[Gambas-user] Problem with UTF-8 in Gambas-connection to MySQL
Dima Malkov
dima.malkov.russia at ...626...
Sun Sep 20 07:11:20 CEST 2009
> > (I don't know English well)
> > Use Debian 5 "Lenny" -32, Gambas 2.7 from repository.
> >
> > I develop an account program for russian 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 got sources of Gambas-2.8.2. Opened main.c file of MySQL driver, found
> > function
> > <<< static int open_database(DB_DESC *desc, DB_DATABASE *db) >>>.
> > Added 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?
> >
> > --
> > Dima Malkov
>
> What is the value of DB.Charset just after you have connected to the database
> in Gambas?
>
> What happens if you uncheck the "use encoding" menu entry if the popup menu in
> the database manager?
>
> Can you send me your database contents, or part of it, so that I test by
> myself?
>
> --
> Beno?t Minisini
The value of DB.Charset just after connection to the database in
Gambas is "utf8".
Unchecking "use encoding UTF8" menu entry has no any visible effect.
This letter includes a ZIP archive. I created a small database by
command "CREATE DATABASE Cyrillic CHARACTER SET utf8;" in
MySQL-console. Then just created a table by command "CREATE TABLE tbl1
(id SERIAL, word VARCHAR(20), PRIMARY KEY (id));". Inserted 5 rows in
MySQL-console, then 5 rows from the "database manager". First 5 rows
are not readable in the "database manager", and last 5 rows are not
readable in MySQL-console.
--
Dima Malkov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cyrillic.zip
Type: application/zip
Size: 48434 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20090920/ac495550/attachment.zip>
More information about the User
mailing list