check formals()$encoding instead of knitr version, per JMarc's suggestion