Added parameter to accept encoding