encoding check

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