public static String escape(String text, char escapeChar,  char[] reserved) {
		StringBuffer buf = new StringBuffer();
		
		for (int i = 0; i < text.length(); i++) {
			char c = text.charAt(i);
			
			// Is the char reserved
			boolean isReserved = false;
			if (reserved != null) {
				for (int j = 0; j < reserved.length; j++) {
					if (c == reserved[j]) {
						isReserved = true;
						break;
					}
				}
			}
			
			// Deal with the type of char
			if (c == escapeChar) {
				buf.append(escapeChar).append(escapeChar);
			} else if (isReserved) {
				buf.append(escapeChar).append(c);
			} else {
				buf.append(c);
			}
		}
		
		return buf.toString();
	}