Wiring diagram for IE58A (Incremental-Encoder)
The datasheet gives a few clues.



Figure 1. The datasheet tells us (1) that we'll need power, (2) there's a signal A and /A output pair, (3) a signal B and /B output pair and (4) a zero reference (once per revolution) signal Z and /Z pair. At two wires each that makes eight wires.

You don't need to reverse engineer this unit any further. You need to find a compatible encoder (watch the pulses per revolution) and figure out the wiring back to whatever is using this one.

Further reading:


How do I get a position from an encoder?.