added a check for encoding to help when being run as a launch agen