renamed to encode(), encodeX()