Use encoding from locale (it seems to be absent as a stream attribute sometimes)