Add tests for {encode,decode}{UTF8,Base64}.
Simplify encoding functions.