Fix header for documents with newlines in the name

Properly urlencode the Document-Id in the Location field of the
header

Based on a patch from Sean Bartell <wingedtachikoma@gmail.com>

Added some eunit-tests

COUCHDB-708