# Poco

# struct UTF8

Library: Foundation
Package: Text
Header: Poco/UTF8String.h

## Description

This class provides static methods that are UTF-8 capable variants of the same functions in Poco/String.h.

The various variants of icompare() provide case insensitive comparison for UTF-8 encoded strings.

toUpper(), toUpperInPlace(), toLower() and toLowerInPlace() provide Unicode-based character case transformation for UTF-8 encoded strings.

removeBOM() removes the UTF-8 Byte Order Mark sequence (0xEF, 0xBB, 0xBF) from the beginning of the given string, if it's there.

## Member Summary

Member Functions: escape, icompare, normalize, removeBOM, toLower, toLowerInPlace, toUpper, toUpperInPlace, unescape

## Enumerations

### NormalizationForm

Normalization form for normalize().

NORMALIZATION_FORM_D

Canonical Decomposition

NORMALIZATION_FORM_C

Canonical Decomposition, followed by Canonical Composition

NORMALIZATION_FORM_KD

Compatibility Decomposition

NORMALIZATION_FORM_KC

Compatibility Decomposition, followed by Canonical Composition

## Member Functions

### escape

static std::string escape(
const std::string & s,
bool strictJSON = false
);

Escapes a string. Special characters like tab, backslash, ... are escaped. Unicode characters are escaped to \uxxxx. If strictJSON is true, \a and \v will be escaped to \\u0007 and \\u000B instead of \\a and \\v for strict JSON conformance.

### escape

static std::string escape(
const std::string::const_iterator & begin,
const std::string::const_iterator & end,
bool strictJSON = false,
bool lowerCaseHex = false
);

Escapes a string. Special characters like tab, backslash, ... are escaped. Unicode characters are escaped to \uxxxx. If strictJSON is true, \a and \v will be escaped to \\u0007 and \\u000B instead of \\a and \\v for strict JSON conformance.

### icompare

static int icompare(
const std::string & str,
std::string::size_type pos,
std::string::size_type n,
std::string::const_iterator it2,
std::string::const_iterator end2
);

### icompare

static int icompare(
const std::string & str1,
const std::string & str2
);

### icompare

static int icompare(
const std::string & str1,
std::string::size_type n1,
const std::string & str2,
std::string::size_type n2
);

### icompare

static int icompare(
const std::string & str1,
std::string::size_type n,
const std::string & str2
);

### icompare

static int icompare(
const std::string & str1,
std::string::size_type pos,
std::string::size_type n,
const std::string & str2
);

### icompare

static int icompare(
const std::string & str1,
std::string::size_type pos1,
std::string::size_type n1,
const std::string & str2,
std::string::size_type pos2,
std::string::size_type n2
);

### icompare

static int icompare(
const std::string & str1,
std::string::size_type pos1,
std::string::size_type n,
const std::string & str2,
std::string::size_type pos2
);

### icompare

static int icompare(
const std::string & str,
std::string::size_type pos,
std::string::size_type n,
const std::string::value_type * ptr
);

### icompare

static int icompare(
const std::string & str,
std::string::size_type pos,
const std::string::value_type * ptr
);

### icompare

static int icompare(
const std::string & str,
const std::string::value_type * ptr
);

### normalize

static std::string normalize(
const std::string & s,
NormalizationForm form
);

Normalizes the given UTF8 string according to the given normalization form. Returns the normalized UTF8 string.

### normalize

static std::string normalize(
const std::string::const_iterator & begin,
const std::string::const_iterator & end,
NormalizationForm form
);

Normalizes the given UTF8 string range according to the given normalization form. Returns the normalized UTF8 string.

### removeBOM

static void removeBOM(
std::string & str
);

Remove the UTF-8 Byte Order Mark sequence (0xEF, 0xBB, 0xBF) from the beginning of the string, if it's there.

### toLower

static std::string toLower(
const std::string & str
);

### toLowerInPlace

static std::string & toLowerInPlace(
std::string & str
);

### toUpper

static std::string toUpper(
const std::string & str
);

### toUpperInPlace

static std::string & toUpperInPlace(
std::string & str
);

### unescape

static std::string unescape(
const std::string & s
);

Creates an UTF8 string from a string that contains escaped characters.

### unescape

static std::string unescape(
const std::string::const_iterator & begin,
const std::string::const_iterator & end
);

Creates an UTF8 string from a string that contains escaped characters.