File:  [Public] / libwww / Library / src / HTEscape.html
Revision 2.3: download - view: text, annotated - select for diffs
Tue Mar 21 17:36:38 1995 UTC (29 years, 2 months ago) by frystyk
Branches: MAIN
CVS tags: v3/0, WindowsNT, HEAD
Getting Library back on main branch

<HTML>
<HEAD>
<TITLE>Escape and Unescape Illegal Characters in URIs</TITLE>
<NEXTID N="1">
</HEAD>
<BODY>

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

<PRE>
/*
**	(c) COPYRIGHT CERN 1994.
**	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 NAME="z10"
HREF="http://info.cern.ch/hypertext/WWW/Library/User/Guide/Guide.html">Library
of Common Code</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>
extern char * HTEscape PARAMS((CONST char * str, unsigned char mask));
</PRE>

The following are valid mask values. The terms are the BNF names in
the URI document.

<PRE>
#define URL_XALPHAS	(unsigned char) 1
#define URL_XPALPHAS	(unsigned char) 2
#define URL_PATH	(unsigned char) 4
</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 PARAMS(( char * str));


#endif	/* HTESCAPE_H */
</PRE>

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


Webmaster