public static String urlPathEncode(String part)
		{
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < part.length(); i++)
			{
			char c = part.charAt(i);
			String valid = "./:-_?=;@&%#";
			if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')
					|| valid.indexOf(c) > -1)
				sb.append(c);
			else
				{
				sb.append('%');
				if (c < 16) sb.append('0');
				sb.append(Integer.toHexString(c));
				}
			}
		return sb.toString();
		}