Move general query functions somewhere that makes sense.
Fix charset handling in filtered replication.
Merge branch 'charset'