Encode Unicode strings using .encode('utf-8') instead of str()