Re: Re: smsd + libmysqlclient charset changes after some time

[email protected] Sat, 26 Jul 2014 20:21:10 +0200
Newsgroups gmane.linux.drivers.gnokii
Message-ID <trinity-ccd6e4f0-21c2-489a-8159-fefa96c42ca5-1406398870205@3capp-gmx-bs58>
Hello,

> Do I understand right, that there is no explicit reconnecting from smsd side?
smsd opens the mysql-connection with the MYSQL_OPT_RECONNECT option set,
so when the connection is lost, libmysqlclient tries to re-open that connection
itself (completely invisible for smsd) and re-sends the failed SQL-statement.
So, yes, there is no explicit reconnection from smsd side.

> From the first look it seem to me like something internal in mysql client
> library but I don't know for sure. Please continue testing and let us know
> the results.
My tests showed, that setting the character encoding just once when the
connection is opened, is sufficient.

Meanwhile, I had to migrate to a new server (from i386 to x64) and did a
clean install of Debian 7 + MySQL-Server + gnokii (both from Debian's repo),
and can now summarize: this setup will not work out-of-the-box when special
characters are needed. Altough all locales installed are UTF8-ones (en_GB.UTF8
being the default one), the connection to the database is opened as latin1
(the encoding is not specified by gnokii-smsd at all), which causes much trouble
when dealing with non-ASCII chars.

What I did to get these chars working: get the source code from Debian's repos,
and manually set the encoding to UTF8 in the DB_ConnectInbox() and DB_ConnectOutbox()
functions.

Just for reference (or to conclude): a smsd-mysql-setup as it is provided in Debian 7
will not work with non-ASCII characters, since the DB-connection's encoding does not
match on both ends, and/or the encoding changes by itself after some time.

An important notice: I've looked up the mysql.c file in gnokii's git, and have seen that
in 0.6.31 the Connect()-function utilizes a MYSQL_SET_CHARSET_NAME option (which was not done
before), so it seems that the whole issue was resolved in that version.
(Debian 7 is still on 0.6.30)
I'll give 0.6.31 a try (compiled manually) as soon as there is some free time (there are
still many things in the queue to get moved to the new server :) )

Best regards,
Paul