uri_normalize


Description:


[ Version ( replacement = "URI.normalize" ) ]
public string uri_normalize (string part, string? unescape_extra)

typeof (unichar2)-decodes any "unreserved" characters (or characters in unescape_extra) in part, and typeof ( unichar2)-encodes any non-ASCII characters, spaces, and non-printing characters in part.

"Unreserved" characters are those that are not allowed to be used for punctuation according to the URI spec. For example, letters are unreserved, so uri_normalize will turn http://example.com/foo/b%61r into http://example.com/foo/bar, which is guaranteed to mean the same thing. However, "/" is "reserved", so http://example.com/foo%2Fbar would not be changed, because it might mean something different to the server.

In the past, this would return null if part contained invalid percent-encoding, but now it just ignores the problem (as URI already did).

Parameters:

part

a URI part

unescape_extra

reserved characters to unescape (or null)

Returns:

the normalized URI part


Namespace: Soup
Package: libsoup-2.4