API to specify encoding
Added documentation