fixed problems when default encoding is not utf8