Fix Unicode and datetime.datetime serialization issues.

Fixes: bab09

Also, formatting of Unicode variables was broken.