Fix for #1714; lost setting DEFAULT_ENCODING in refactor