# Xapian::Unicode Namespace Reference

Functions associated with handling Unicode characters. More...

## Enumerations
enum | category { UNASSIGNED, UPPERCASE_LETTER, LOWERCASE_LETTER, TITLECASE_LETTER, MODIFIER_LETTER, OTHER_LETTER, NON_SPACING_MARK, ENCLOSING_MARK, COMBINING_SPACING_MARK, DECIMAL_DIGIT_NUMBER, LETTER_NUMBER, OTHER_NUMBER, SPACE_SEPARATOR, LINE_SEPARATOR, PARAGRAPH_SEPARATOR, CONTROL, FORMAT, PRIVATE_USE, SURROGATE, CONNECTOR_PUNCTUATION, DASH_PUNCTUATION, OPEN_PUNCTUATION, CLOSE_PUNCTUATION, INITIAL_QUOTE_PUNCTUATION, FINAL_QUOTE_PUNCTUATION, OTHER_PUNCTUATION, MATH_SYMBOL, CURRENCY_SYMBOL, MODIFIER_SYMBOL, OTHER_SYMBOL }
| Each Unicode character is in exactly one of these categories. More...
## Functions
unsigned | nonascii_to_utf8 (unsigned ch, char *buf)
| Convert a single non-ASCII Unicode character to UTF-8.
unsigned | to_utf8 (unsigned ch, char *buf)
| Convert a single Unicode character to UTF-8.
void | append_utf8 (std::string &s, unsigned ch)
| Append the UTF-8 representation of a single Unicode character to a std::string.
category | get_category (unsigned ch)
| Return the category which a given Unicode character falls into.
bool | is_wordchar (unsigned ch)
| Test if a given Unicode character is "word character".
bool | is_whitespace (unsigned ch)
| Test if a given Unicode character is a whitespace character.
bool | is_currency (unsigned ch)
| Test if a given Unicode character is a currency symbol.
unsigned | tolower (unsigned ch)
| Convert a Unicode character to lowercase.
unsigned | toupper (unsigned ch)
| Convert a Unicode character to uppercase.
std::string | tolower (const std::string &term)
| Convert a UTF-8 std::string to lowercase.
std::string | toupper (const std::string &term)
| Convert a UTF-8 std::string to uppercase.

## Detailed Description

Functions associated with handling Unicode characters.

## Enumeration Type Documentation

enum Xapian::Unicode::category

Each Unicode character is in exactly one of these categories.

## Function Documentation

void Xapian::Unicode::append_utf8 | ( | std::string & | s,
|  | unsigned | ch |
| ) |  |  | `[inline]`

Append the UTF-8 representation of a single Unicode character to a std::string.

References to_utf8().

Referenced by tolower(), and toupper().

category Xapian::Unicode::get_category | ( | unsigned | ch | ) | `[inline]`

Return the category which a given Unicode character falls into.

Referenced by is_currency(), is_whitespace(), and is_wordchar().

bool Xapian::Unicode::is_currency | ( | unsigned | ch | ) | `[inline]`

Test if a given Unicode character is a currency symbol.

References get_category().

bool Xapian::Unicode::is_whitespace | ( | unsigned | ch | ) | `[inline]`

Test if a given Unicode character is a whitespace character.

References get_category().

bool Xapian::Unicode::is_wordchar | ( | unsigned | ch | ) | `[inline]`

Test if a given Unicode character is "word character".

References get_category().

unsigned Xapian::Unicode::nonascii_to_utf8 | ( | unsigned | ch,
|  | char * | buf |
| ) |  |  |

Convert a single non-ASCII Unicode character to UTF-8.

This is intended mainly as a helper method for to_utf8().

The character ch (which must be > 128) is written to the buffer buf and the length of the resultant UTF-8 character is returned.

NB buf must have space for (at least) 4 bytes.

Referenced by to_utf8().

unsigned Xapian::Unicode::to_utf8 | ( | unsigned | ch,
|  | char * | buf |
| ) |  |  | `[inline]`

Convert a single Unicode character to UTF-8.

The character ch is written to the buffer buf and the length of the resultant UTF-8 character is returned.

NB buf must have space for (at least) 4 bytes.

References nonascii_to_utf8().

Referenced by append_utf8().

std::string Xapian::Unicode::tolower | ( | const std::string & | term | ) | `[inline]`

Convert a UTF-8 std::string to lowercase.

References append_utf8(), and tolower().

unsigned Xapian::Unicode::tolower | ( | unsigned | ch | ) | `[inline]`

Convert a Unicode character to lowercase.

Referenced by tolower().

std::string Xapian::Unicode::toupper | ( | const std::string & | term | ) | `[inline]`

Convert a UTF-8 std::string to uppercase.

References append_utf8(), and toupper().

unsigned Xapian::Unicode::toupper | ( | unsigned | ch | ) | `[inline]`

Convert a Unicode character to uppercase.

Referenced by toupper().