I use quite a few different encoders - enough that I made several encoder test gizmos.
As pointed out, the Spec Sheet is the starting point.
Several of the same Physical-looking parts do have different pin attachments for GND and A & B.
Take note that even the same brand, same looking… but, pins are different…
Regarding the Fritzing part:
Usually I use the Pin part with 2 & 3 pins and the Hole part for the 2 retaining legs.
However, there is a Fritzing Encoder Part that works - it has 3 pins and 5 pins and 2 retaining legs. I don’t hook up the the un-needed pins (the extra 3 pins on the 2pin side).
Images of test encoders and the Fritzing encoder
