2.2 Special Character Escaping

Encoding of characters in this structure MUST be represented consistently with the URI specification ([RFC3986], Section 2).

Some characters MUST be specially escaped before the structure is percent-encoded as follows.

If any of the characters "&", "\", "[", "]", or "|" are part of the value of the base-url, site-name, list-name, list-url, or folder-url field, they MUST be preceded by a "|" character.

The base-url, site-name, list-name, list-url, and folder-url fields can contain Unicode characters. Unicode characters MUST be encoded as the 4-digit hexadecimal representation of the character in square brackets "[ ]". Groups of consecutive Unicode characters MUST concatenate the groups and use one set of brackets to enclose all the hexadecimal characters.

The syntax of the StsSync Data Structure, including character escaping, is defined by the following Augmented Backus-Naur form (ABNF) ([RFC5234]) rules:

 stssyncuri  = scheme ":" schemepart
 scheme      = "stssync"
 schemepart  = "//sts/?" [ params ]
 params      = param *("&" param)
 param       = key "=" value
 key         = *( ALPHA / "-" )
 value       = *uchar
 uchar       = escape / unreserved
 unreserved  = ALPHA / DIGIT / punctuation
 punctuation = "(" / ")" / "_" / "/" / "[" / "]" / "|" / "." / "-"
 escape      = "%" 2HEXDIG