changed harded-coded encoding string to encoding parameter