I have a Python script that writes some strings with UTF-8 encoding. In my script I am using mainly the str() function to cast to string. It looks like that:
str()
If it outputs to the terminal then Python can examine the value of $LANG to pick a charset. All bets are off if you redirect.
$LANG