i introduced the %encoded-folder% symbol as you proposed, but i don't understand why you used a loop to do it.
that's how i did
// build up base table
table:=NIL;
addArray(table, [
'\n', CRLF,
'%timestamp%', DateTimeToStr(now()),
'%version%', VERSION,
'%uptime%', uptimestr(),
'%folder%', includeTrailingChar('/', decodeURL(folder.url())),
'%encoded-folder%',
encodeURL(includeTrailingChar('/', decodeURL(folder.url()))),
'%parent-folder%',
encodeURL(includeTrailingChar('/', decodeURL(folder.parenturl())))
]);