xdg: fix crash when non utf-8 .desktop files are found

On my box, /usr/share/applications/grip.desktop is not utf-encoded.
Note that this causes the test to fail, not sure what is the best way to make the test pass
test/test_spawn: use sync instead of sleeping
Merge pull request #2 from yannicklm/master

xdg: fix crash when non utf-8 .desktop files are found