encode for utf-8 output