[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'System' (#rtl)

# UTF8Encode

Convert a widestring or unicodestring to an UTF-8 encoded ansistring

## Declaration

Source position: ustringh.inc line 138

`function UTF8Encode(`
`const s: RawByteString`
`):RawByteString; function UTF8Encode(`
`const s: UnicodeString`
`):RawByteString; function UTF8Encode(`
`const s: WideString`
`):RawByteString;`

## Description

UTF8Encode converts an ansistring or widestring S to the equivalent UTF-8 encoded Unicode string and returns this resulting string. It calls the low-level UnicodeToUTF8 function to do the actual work.

The resulting string has code page CP_UTF8.

## See also

UTF8Decode |  | Convert an UTF-8 encoded ansistring to a unicodestring
Utf8ToAnsi |  | Convert a UTF-8 encoded Unicode string to an ansistring
UnicodeToUtf8 |  |
SetWideStringManager |  | Set the widestring manager

Documentation generated on: May 14 2021