Unicode tests & fixes

This adds some tests for unicode data, and changes to make the SQL writer generally more aggressive about being unicode everywhere. It may have problems with wacky DBs with no native unicode support, but I don't know which those are and we should try to insist on not supporting them anyhow, if possible.