Summarize the following:
There's some truth to the old adage that dogs and other animals can "sense fear". If you become agitated and run or scream, you may make the dog feel more confident in his attack, or, worse, you may appear threatening to the dog. Neither of these is a good situation to be in. When a dog approaches, stand completely still with your hands at your sides, like a tree, and avert your eyes. In many cases the dog will lose interest and walk away if you ignore him.  Do not wave your arms around or kick with your legs; the dog may perceive these actions as threatening. Don't make eye contact, since that could also cause the dog to lunge. Stand sideways to the dog and keep him in your peripheral vision instead of facing him and making eye contact. This will signal to the dog that you are not a threat. Don't open your hands and arms up to a bite by extending them. Keep your fingers curled into fists to avoid getting them bitten.  The dog may come quite close, even sniffing you, without actually biting. Running away can awaken the dog's prey instinct to chase and catch animals. He may pursue you vigorously even if his initial intent was just playful.  Additionally, you won't be able to outrun most dogs if you're on foot. Even if you are on a bicycle, many dogs will be able to catch up to you. If the dog continues to threaten you, offer him something to chew on, such as your backpack or water bottle: anything but your arm or leg. This may distract him enough to give you time to escape. You may want to carry treats or toys when traveling in areas known to be home to dangerous dogs. If approached by an angry dog, throw your treats or toy away from you. The dog may go after these instead of you.

Summary:
Do not panic. Make yourself rigid and motionless. Do not try to run away. Distract the dog with another object.