Backport of upstream patch to fix errors with spaces in usernames

https://github.com/fruux/sabre-dav/issues/365
https://github.com/owncloud/contacts/issues/137#issuecomment-25155120
https://github.com/owncloud/calendar/issues/154

@DeepDiver1975 @bartv2 @karlitschek