There seems to be another problem with mysql reconnects and charsets. I was not able to track is down completely, but it happens in the following scenario. We are running the Sql.Sql object connected to mysql with charset "unicode". After a reconnect when an update is sent that fits into latin1 but contains some characters around \345, the server seems to discard all data after the first of these chars. To me it seems like the server is actually expecting utf8 and encounters a malformed sequence. Even though pike is sending 'SET character_set_client = latin1'. This can be checked by using something like "\345\202\254" which is ok for _can_send_as_latin1 and is a valid utf8 sequence at the same time (becomes \u586c which looks chinese).
We are currently fixing this by disabling the fallback to latin1 in lib/modules/Sql.pmod/mysql.pike:627.
Any hints appreciated.
best
arne