When you're generating the html, could you insert "%20" where you find spaces?
Something like s/ /%20/g.
Then your former, unclickable link like <a href='file://space is the place'>
would be transformed to <a href='file://space%20is%20the%20place'>, thus rendering it clickable.