Is there a way to URL encode a string in a variable? I have strings containing things like ampersands that need to be converted to %26 and similar.