I have the same encoder Q9864 module from the HP printer but the arduino interrupts fire randomly.
I'm using the encoder in place, didn't remove it to use the encoder wheel, just removed the connection with the printer board.
I'm using Arduino mega with interrupts on pins 20 & 21, I connect as the following picture, when I turn the printer wheel the multimeter shows volts between 1 and 4.8 volts, so the pinout of the encoder is fine, but the Arduino interrupts are not working as excepected.