I have file names with spaces. When Alkaline outputs results, they contain a space and the link is wrong. How can I urlencode these?

Alkaline regexp has a method called URLENCODE . To encode all links in the search results simply add |URLENCODE to the $url variable in the <!--SET MAP ... --> section. For example:
<!--SET MAP--$recent <a 
  href="$url|URLENCODE" target="_new">$title</a>
-->