Set encoding
Yet more unit testing.