Test encoding