A pure (windows) “C” version of urlencode

This is a windows pure C language version of a urlencode() function.
Sometimes, when I need simple tools and self contained windows EXEs (“just run it”, no “dll”s to copy or register), I find it simpler to code in C than in other languages. Particularly when you want to link with specialized libraries available only in C. So, I scavenged the web for a ready to use urlencode routine and found nothing really useable out of the box. Although this one is largely inspired by what I found.

Example:

Enjoy !