Encodes a buffer by trimming leading zero bytes. Finds the first non-zero byte and returns a new buffer starting from that byte. Returns an empty buffer if all bytes are zero.