my $val_url = URI::Escape::uri_escape_utf8( $val // q{} );
$ret =~ s/\{$key\}/$val_url/g;
}
$ret =~ s/\{[^\{]*\}//g; # remove remaining vars
$ret =~ s/\{[A-Z0-9_]+\}//g; # remove remaining vars
return $ret;
-