---
name: "unicode::iconvert::tou"
section: "3"
platform: "linux"
package: "libcourier-unicode-dev"
version: "2.3.2-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/unicode::iconvert::tou"
---

# unicode::iconvert::tou(3)

template for converting text sequence to unicode

## NAME

unicode::iconvert::tou - template for converting text sequence to unicode

## SYNOPSIS

```
#include <courier-unicode.h>
```

**output\_iter\_t convert(input\_iter\_t** *beg\_iter***, input\_iter\_t** *end\_iter***, const std::string &***charset***, bool &***errflag***, output\_iter\_t** *output\_iter***);**

**bool convert(input\_iter\_t** *beg\_iter***, input\_iter\_t** *end\_iter***, const std::string &***charset***, std::u32string &***out\_buf***);**

**std::pair\<std::u32string, bool\> convert(const std::string &***text***, const std::string &***charset***);**

## DESCRIPTION

These template functions convert text in a given character set to unicode characters. *beg\_iter* and *end\_iter* define an input sequence of chars in the *charset* character set. They get converted to unicode characters. *output\_iter* is an output iterator that **convert**() iterates over char32\_ts. **convert**() returns the value of the output iterator after iterating over the converted character sequence. *errflag*, passed by reference, gets set to true if some character could not be converted to unicode, from the specified character set, and false if the conversion completed without errors.

An overloaded **convert**() puts the unicode character sequence into a vector of char32\_ts, instead of an output sequence, and returned the error flag. Finally, a single std::string specifies the character string, instead of a beginning and an ending iterator, and returns a std::pair with the converted unicode text in a vector, and the error flag.

## SEE ALSO

[**courier-unicode**(7)](/courier-unicode/7.md), **unicode::convert::convert**(3), [**unicode\_convert**(3)](/unicode_convert/3.md), [**iconv**(3)](/iconv/3.md).

## AUTHOR

**Sam Varshavchik**

Author
