# Poco

# class UnicodeConverter

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

## Description

A convenience class that converts strings from UTF-8 encoded std::strings to UTF-16 encoded std::wstrings and vice-versa.

This class is mainly used for working with the Unicode Windows APIs and probably won't be of much use anywhere else.

## Member Summary

Member Functions: toUTF16, toUTF8

## Member Functions

### toUTF16

static void toUTF16(
const std::string & utf8String,
std::wstring & utf16String
);

Converts the given UTF-8 encoded string into an UTF-16 encoded wstring.

### toUTF16

static void toUTF16(
const char * utf8String,
int length,
std::wstring & utf16String
);

Converts the given UTF-8 encoded character sequence into an UTF-16 encoded string.

### toUTF16

static void toUTF16(
const char * utf8String,
std::wstring & utf16String
);

Converts the given zero-terminated UTF-8 encoded character sequence into an UTF-16 encoded wstring.

### toUTF8

static void toUTF8(
const std::wstring & utf16String,
std::string & utf8String
);

Converts the given UTF-16 encoded wstring into an UTF-8 encoded string.

### toUTF8

static void toUTF8(
const wchar_t * utf16String,
int length,
std::string & utf8String
);

Converts the given zero-terminated UTF-16 encoded wide character sequence into an UTF-8 encoded wstring.

### toUTF8

static void toUTF8(
const wchar_t * utf16String,
std::string & utf8String
);

Converts the given UTF-16 encoded zero terminated character sequence into an UTF-8 encoded string.