Added safe encodeURIcomponent to eliminate errors on malformed captures.