fix encoder for strings with special chars