Using URI Utilities

This tutorial describes the steps to use URI utilities.

Introduction

UriUtils class checks URIs for invalid characters and has both 8 and 16-bit variants. It provides additional utilities for CUri8 and CAuthority8 classes. The method used to check URIs is HasValidChars(), which is passed through descriptor data to check and return a boolean indicating whether invalid characters were found or not.

You can create URI (CUri8 object) from a Unicode descriptor using UriUtils::CreateUriL(). Refer to Creating an URI for details.

Validating URI for invalid characters

HasInvalidChars() checks for any excluded (also called invalid) characters in the URI to validate the invalid characters. The following are set of invalid characters:

Category Character set

Control characters

Values 0x00 to 0x1F and greater than 0x7F

Space

0x20

Delimiters

'<', '>', '#', '%', '"'

Unwise characters

' {', '}', '|', '\', '^', '[', ']', '`'

Validating URI for valid host

HostType() validates the URI for the following valid host types as defined in TUriHostType:

  • IPv6, for example, 1080:0:0:0:8:800:200C:417A

  • IPv4, for example, 192.168.202.18

  • Text form, for example, www.mywebpage.com