Don't pass None to str.encode either