File:  [Public] / libwww / Library / src / HTEscape.html
Revision 2.8: download - view: text, annotated - select for diffs
Wed Sep 20 18:29:29 1995 UTC (28 years, 8 months ago) by frystyk
Branches: MAIN
CVS tags: v4/0pre6, v4/0pre5, v4/0pre4, v4/0pre3, v4/0D, v4/0C, v4/0B, v4/0, autoconf, HEAD
Snapshot getting ready

<HTML>
<HEAD>
<TITLE>Escape and Unescape Illegal Characters in URIs</TITLE>
<!-- Changed by: Henrik Frystyk Nielsen, 19-Sep-1995 -->
<NEXTID N="1">
</HEAD>
<BODY>

<H1>Escape and Unescape Illegal Characters in URIs</H1>

<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>

This module have been spawned from <A HREF="HTParse.html">HTParse</A>,
as it then can be used in utility programs without loading a whole
bunch of the library code. It contains functions for escaping and
unescaping a URI for reserved characters in URIs. <P>

This module is implemented by <A HREF="HTEscape.c">HTEscape.c</A>, and
it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
Reference Library</A>.

<PRE>
#ifndef HTESCAPE_H
#define HTESCAPE_H

</PRE>

<H2>Encode Unacceptable Characters using %xy</H2>

This funtion takes a string containing any sequence of ASCII
characters, and returns a malloced string containing the same
infromation but with all "unacceptable" characters represented in the
form <CODE>%xy</CODE> where <CODE>x</CODE> and <CODE>y</CODE> are two
hex digits.

<PRE>
typedef enum _HTURIEncoding {
    URL_XALPHAS		= 0x1,
    URL_XPALPHAS	= 0x2,
    URL_PATH		= 0x4
} HTURIEncoding;

extern char * HTEscape (CONST char * str, HTURIEncoding mask);
</PRE>

<H2>Decode %xy Escaped Characters</H2>

This function takes a pointer to a string in which character smay have
been encoded in <CODE>%xy</CODE> form, where <CODE>xy</CODE> is the
acsii hex code for character 16x+y. The string is converted in place,
as it will never grow.

<PRE>
extern char * HTUnEscape (char * str);
</PRE>

<PRE>
#endif	/* HTESCAPE_H */
</PRE>

End of HTEscape Module
</BODY>
</HTML>


Webmaster