Encode to UTF8 in the correct place

Fixes wide character entry warning