URI:String

Import List

    ADT:StringBuffer
    URI:CharClass
 
Type Summary
Offset = INTEGER

          
Procedure Summary
AppendEscaped(STRING, ARRAY OF CHAR, StringBuffer)

          Appends the string source to dest, possibly escaping some characters on the way.
Unescape(STRING): STRING

          Replaces escaped characters with their ISO Latin-1 counterparts.

Type Detail

Offset

TYPE Offset = INTEGER
Procedure Detail

AppendEscaped

PROCEDURE AppendEscaped(source: STRING; 
                        unreserved: ARRAY OF CHAR; 
                        dest: StringBuffer)

Appends the string source to dest, possibly escaping some characters on the way. All characters from CharClass.IsUnreserved and all characters in unreserved are copied as is. Any other characters are translated into a three character sequence `%HH', where `H' is a hex digit from `[0-9A-F]'. If dest cannot hold the whole result, then the result string is truncated.


Unescape

PROCEDURE Unescape(x: STRING): STRING

Replaces escaped characters with their ISO Latin-1 counterparts. The escape sequence `%00' is translated to a space (ASCII code 32).

Pre-condition: The string x is well-formed. That is, every occurence of the character `%' is followed by two valid hexadecimal digits.