Encode string in tests to ensure python3 compatibility