working encoding exception: exit on error