Index: pextlib1.0/curl.c
===================================================================
--- pextlib1.0/curl.c	(revision 47869)
+++ pextlib1.0/curl.c	(working copy)
@@ -81,6 +81,7 @@
 int SetResultFromCurlErrorCode(Tcl_Interp* interp, CURLcode inErrorCode);
 int CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
 int CurlIsNewerCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
+int CurlEscapeCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
 
 /* ========================================================================= **
  * Entry points
@@ -809,6 +810,43 @@
 }
 
 /**
+ * curl escape subcommand entry point.
+ *
+ * syntax: curl escape <string>
+ *
+ * @param interp		current interpreter
+ * @param objc			number of parameters
+ * @param objv			parameters
+ */
+int
+CurlEscapeCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
+{
+	int theResult = TCL_OK;
+	CURL* theHandle = NULL;
+	const char* theString = NULL;
+	char* escapedString = NULL;
+
+	if (objc != 3) {
+		Tcl_WrongNumArgs(interp, 1, objv, "escape string");
+		return TCL_ERROR;
+	}
+
+	theString = Tcl_GetString(objv[2]);
+
+	/* Create the CURL handle */
+	theHandle = curl_easy_init();
+
+	/* Escape the string */
+	escapedString = curl_easy_escape(theHandle, theString, 0);
+	Tcl_SetResult(interp, escapedString, TCL_VOLATILE);
+
+	curl_free(escapedString);
+	curl_easy_cleanup(theHandle);
+
+	return theResult;
+}
+
+/**
  * curl command entry point.
  *
  * @param clientData	custom data (ignored)
@@ -826,11 +864,12 @@
     typedef enum {
     	kCurlFetch,
     	kCurlIsNewer,
-    	kCurlGetSize
+    	kCurlGetSize,
+    	kCurlEscape
     } EOption;
     
 	static tableEntryString options[] = {
-		"fetch", "isnewer", "getsize", NULL
+		"fetch", "isnewer", "getsize", "escape", NULL
 	};
 	int theResult = TCL_OK;
     EOption theOptionIndex;
@@ -861,6 +900,11 @@
 			case kCurlGetSize:
 				theResult = CurlGetSizeCmd(interp, objc, objv);
 				break;
+
+                        case kCurlEscape:
+				theResult = CurlEscapeCmd(interp, objc, objv);
+				break;
+
 		}
 	}
 	

