If it's anything like the encoders in solvent machines, alcohol should be fine. I wouldn't use denatured alcohol but would use the regular 70% isopropyl stuff.
They are and aren't. HP's manual for the FB700 (I know, different machine, but I'd guess same guidelines) suggests being
very careful when cleaning the encoder so you don't scrub off the marks. They
do say you can use a 70/30 mix of alcohol and water, but under no circumstances should you "scrub."
For the OP, if your encoder is that dirty, you may need to change it. If you're going to try the scrubbing method, I'd suggest not doing it until you have a replacement on hand to replace it if it doesn't work. If it does work, you at least have one for when cleaning no longer helps.