convert automatically rendered links to xwiki/2.1 syntax

also need to encode search terms, too;
extract encoding helper for easier reuse