I believe it can be done with just diodes but you run the risk of running too much current through your encoder. The safest way is with diodes and transistors. I have set this up before (I had relays powering the counter but that is overkill...the circuit is basically the same though). If no-one else posts a schematic, I can draw one up this weekend.