return null string if null is pass in to be encoded