Added encoding option for connection. (default=None)