I love dogs and I think that they're amazing creatures... But if someone else's dog ran up and got a hold of my arm/leg, i'd just punch it in the nose.. Or hold it in the air by the collar and take it to the owner and tell them to "train their bloody dog!"
Some dogs instinctually like to chase things/people that move/run away from them, so if one did chase you and you stopped and turned around, I doubt they'd bite you, they'd just want a pat. Either way, pepper spray is fine but I would wait until the dog ACTUALLY bit me first, that way if the owner gets mad at you, you can always say: "You're lucky i'm not a jerk, otherwise I could sue you and get the dog euthanized."
On a side note, when I get a dog and train it right I will also let it off the leash in parks and along rivers; some dogs are trained to be good in that situation, others are aggressive and chase you, and others are just extremely social and lack training, they won't bite you but it's annoying having dogs run up to you when you just want to enjoy your run without needing to stop each time.
Edit: that guy above me is right to an extent.. while any dog that I owned wouldn't chase or attack others, if someone sprayed it I so would follow them home and throw a rock through their front window.