Support UTF8 in external format, cleanup code