- only encode if there's anything to encode