fix encoding issues when the default encoding is not set