Converts a given name into url save and readable urlanme.
 Uses rails parameterize, but converts german umlauts before.

 @returns String
492182
def convert_to_urlname(name)
      name
        .gsub(/[äÄ]/, 'ae')
        .gsub(/[üÜ]/, 'ue')
        .gsub(/[öÖ]/, 'oe')
        .gsub(/[ß]/, 'ss')
        .parameterize
    end
1211284
private String mapToFogbugzUrl(Map<String, String> params) throws UnsupportedEncodingException {
        String output = this.getFogbugzUrl();
        for (String key : params.keySet()) {
            String value = params.get(key);
            if (!value.isEmpty()) {
                output += "&" + URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8");
            }
        }
        FogbugzManager.log.info("Generated URL to send to Fogbugz: " + output);
        return output;
    }
819777
def http_url(full_name, prefix)
      path = full_name.dup

      path.gsub!(/<<\s*(\w*)/, 'from-\1') if path['<<']

      ::File.join(prefix, path.split("::")) + ".html"
    end
142421
private static String encodeExampleForUrl(Object example) {
        try {
            return URLEncoder.encode(String.valueOf(example), "UTF-8");
        } catch (UnsupportedEncodingException exception) {
            throw new RuntimeException(exception);
        }
    }
1052171
function formatUrlPref(prefName) {
  var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
                     .getService(Ci.nsIURLFormatter);

  return formatter.formatURLPref(prefName);
}
1084128
function getURLParameter(url, name) {
        var URLParamRegEx = new RegExp('[?|&]?' + name + '=([^&;]+?)(&|#|;|$)');
        var value = URLParamRegEx.exec(url);
        value = (value) ? value[1] : "";
        return decodeURIComponent(value.replace(/\+/g, '%20')) || null;
    }
694935
public static String decode(String urlString) {
		StringBuilder s = new StringBuilder();
		UrlDecoderState state = UrlDecoderState.INITIAL;
		int hiNibble = 0;
		int lowNibble = 0;
		int length = urlString.length();
		for (int i = 0; i < length; i++) {
			char c = urlString.charAt(i);
			switch (state) {
			case INITIAL:
				if (c == '%') {
					state = UrlDecoderState.FIRST_HEX;
				} else {
					s.append(c);
				}
				break;
			case FIRST_HEX:
				hiNibble = lookup(c);
				state = UrlDecoderState.SECOND_HEX;
				break;
			case SECOND_HEX:
				lowNibble = lookup(c);
				byte b = (byte) ((hiNibble << 4) | lowNibble);
				s.append((char) b);
				state = UrlDecoderState.INITIAL;
				break;
			}
		}
		return s.toString();
	}
1102620
function getURLParameter (name, url) {
    name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(url);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
238384
def url(self, name):
        """"""
        scheme = 'http'
        path = self._prepend_name_prefix(name)
        query = ''
        fragment = ''
        url_tuple = (scheme, self.netloc, path, query, fragment)
        return urllib.parse.urlunsplit(url_tuple)
638611
private String convertURItoURL(String uri) {
        int indexScheme = uri.indexOf("://");
        if (-1 != indexScheme) {
            int indexQuery = uri.indexOf('?');
            if (-1 == indexQuery || indexScheme < indexQuery) {
                // already a full url
                return uri;
            }
        }
        StringBuilder sb = new StringBuilder();
        String scheme = this.request.getScheme();
        sb.append(scheme).append("://");
        sb.append(this.request.getServerName());
        int port = this.request.getServerPort();
        if ("http".equalsIgnoreCase(scheme) && 80 != port) {
            sb.append(':').append(port);
        } else if ("https".equalsIgnoreCase(scheme) && 443 != port) {
            sb.append(':').append(port);
        }
        String data = this.request.getContextPath();
        if (!"".equals(data)) {
            sb.append(data);
        }
        if (0 == uri.length()) {
            sb.append('/');
        } else if (uri.charAt(0) == '/') {
            // relative to servlet container root...
            sb.append(uri);
        } else {
            // relative to current URI,
            data = this.request.getServletPath();
            if (!"".equals(data)) {
                sb.append(data);
            }
            data = this.request.getPathInfo();
            if (null != data) {
                sb.append(data);
            }
            sb.append('/');
            sb.append(uri);
            // TODO: webcontainer converted "/./" and "/../" info too
        }

        return sb.toString();
    }
1343643
private String urlencode(String data, String charset) {
        try {
            return URLEncoder.encode(String.valueOf(data), charset);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
1029853
def url_encode(str)
      encoded_string = ""
      str.each_char do |char|
        case char
        when "+"
          encoded_string << "%2b"
        when "="
          encoded_string << "%3d"
        when "?"
          encoded_string << "%3f"
        when "&"
          encoded_string << "%26"
        when "%"
          encoded_string << "%25"
        when ","
          encoded_string << "%2C"
        else
          encoded_string << char
        end
      end
      encoded_string
    end
1075515
def translate_uri(request)
			@@empty_check ||= Regexp.new('^/?$')
			@@lang_check ||= Regexp.new('^/[a-z]{2}(/|$)')
      uri = request.path
      request.uri ||= uri
      config = config(request)
      handle_shortcut(request, config)
      case uri
      when @@empty_check
        request.uri = config['redirect']['/'] ||= @handler_uri
      when @@lang_check
        begin
          self.parse_uri(request)
        rescue LoadError # this happens often
          res = simple_parse_uri(request)
        end
        request.uri = @handler_uri
      end
      Apache::DECLINED
		end
625087
def get_resource_name( url )
      new_url = url.gsub( '(.:format)', '' )

      return $1 if new_url =~ /\/(\w+)\/:id$/         # /users/:id (users)
      return $1 if new_url =~ /\/(\w+)\/:id\/edit$/   # /users/:id/edit (users)
      return $1 if new_url =~ /^\/(\w+)$/             # /users  (users)
      return $1 if new_url =~ /\/:\w*id\/(\w+)$/      # /users/:id/images (images)
      return $1 if new_url =~ /\/:\w*id\/(\w+)\/\w+$/ # /users/:id/config/edit (users)
      return $1 if new_url =~ /^\/(\w+)\/\w+$/        # /users/edit (users)
      return $1 if new_url =~ /\/(\w+)\/\w+\/\w+$/    # /users/password/edit (users)
      return url
    end
355300
public function compileUrl()
    {
        $append = '';
        if (count($this->compiledValues) > 0) {
            $append = implode('', $this->compiledValues);
        }

        return $this->name.$append;
    }
415103
def safe_filename(url)
      url  = url.sub(/\?.*\Z/, '')
      ext  = File.extname(url)
      name = URI.unescape(File.basename(url)).gsub(/[^a-zA-Z0-9_\-.]/, '-').gsub(/-+/, '-')
      File.basename(name, ext).gsub('.', '-') + ext
    end
1119536
function (url, qsName, qsValue) {

    let urlObj = Url.parse(url);
    if (qsName && qsValue) {
        urlObj.query = Querystring.parse(qsName + '=' + qsValue);
        urlObj.search = '?' + encodeURIComponent(qsName) + '=' + encodeURIComponent(qsValue);
    } else {
        urlObj.search = '';
    }
    return urlObj.format(urlObj);
}