fixes an undefined error when encoding not specified

I was getting an error when encoding was undefined.  I didn't see any test cases that covered anything so I didn't add any.