urlencode.c File Reference

#include "nsd.h"

Functions

char * Ns_EncodeUrlWithEncoding (Ns_DString *dsPtr, char *string, Tcl_Encoding encoding)
char * Ns_EncodeUrlCharset (Ns_DString *dsPtr, char *string, char *charset)
char * Ns_DecodeUrlCharset (Ns_DString *dsPtr, char *string, char *charset)
char * Ns_DecodeUrlWithEncoding (Ns_DString *dsPtr, char *string, Tcl_Encoding encoding)
int NsTclUrlDecodeObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
int NsTclUrlEncodeObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])

Variables

struct {
   int   hex
   int   len
   char *   str
enc []

Function Documentation

char* Ns_DecodeUrlCharset ( Ns_DString *  dsPtr,
char *  string,
char *  charset 
)

----------------------------------------------------------------------

Ns_DecodeUrlCharset --

Decode an encoded URL (with hexcode, etc.).

Results: A pointer to the dstring's value, containing the decoded URL.

Side effects: Decoded URL will be copied to given dstring.

----------------------------------------------------------------------

char* Ns_DecodeUrlWithEncoding ( Ns_DString *  dsPtr,
char *  string,
Tcl_Encoding  encoding 
)

----------------------------------------------------------------------

Ns_DecodeUrlWithEncoding --

Decode an encoded URL (with hexcode, etc.).

Results: A pointer to the dstring's value, containing the decoded URL.

Side effects: Decoded URL will be copied to given dstring.

----------------------------------------------------------------------

If using an encoding, copy output to a scratch buffer instead of directly to given dstring.

Expand the output to the length of the input string which will be the largest size required.

Terminate the dstring, decoding to utf8 if necessary.

char* Ns_EncodeUrlCharset ( Ns_DString *  dsPtr,
char *  string,
char *  charset 
)

----------------------------------------------------------------------

Ns_EncodeUrlCharset --

Take a URL and encode any non-alphanumeric characters into hexcode

Results: A pointer to the encoded string (which is part of the passed-in DString's memory)

Side effects: Encoded URL will be copied to given dstring.

----------------------------------------------------------------------

char* Ns_EncodeUrlWithEncoding ( Ns_DString *  dsPtr,
char *  string,
Tcl_Encoding  encoding 
)

----------------------------------------------------------------------

Ns_EncodeUrlWithEncoding --

Take a URL and encode any non-alphanumeric characters into hexcode

Results: A pointer to the encoded string (which is part of the passed-in DString's memory)

Side effects: Encoded URL will be copied to given dstring.

----------------------------------------------------------------------

Determine and set the required dstring length.

Copy the result directly to the pre-sized dstring.

int NsTclUrlDecodeObjCmd ( ClientData  arg,
Tcl_Interp *  interp,
int  objc,
Tcl_Obj *CONST  objv[] 
)

int NsTclUrlEncodeObjCmd ( ClientData  arg,
Tcl_Interp *  interp,
int  objc,
Tcl_Obj *CONST  objv[] 
)


Variable Documentation

struct { ... } enc[]

The following table is used for URL encoding and decoding all 256 characters.

int hex

int len

Valid hex value or -1.

char* str

Length required to encode string.


Generated on Tue Sep 4 19:58:56 2007 by  doxygen 1.5.1