Assume UTF-8 if no valid encoding known (via #1021)

A stab at preventing #1021 for the future.