Add 'encoding' option to allow overriding server encoding