Navigation
API > API/Runtime > API/Runtime/Core
Iterator for decoding a UTF-8 encoded string view as Unicode codepoints (UTF-32).
Usage: for (FUtf8Iterator It(MyStringView); It; ++It) { UTF32CHAR Codepoint = *It; }
Invalid UTF-8 sequences are decoded following the Unicode Standard's "maximal subpart" rule: each maximal initial subsequence of bytes that could be the beginning of a well-formed sequence is replaced by exactly one U+FFFD replacement character. In practice this means that a lone invalid or out-of-range lead byte is consumed by itself, and any continuation bytes (0x80–0xBF) that follow it are each decoded as independent errors, each producing their own replacement character.
Sequences truncated at the end of the view also produce a replacement character and advance the iterator to the end of the view.
Zero bytes within the view are treated as ordinary data and do not terminate iteration.
The iterator is non-copyable. Construct it with an explicit FUtf8StringView.
| Name | FUtf8Iterator |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Utf8/Utf8Iterator.h |
| Include Path | #include "Utf8/Utf8Iterator.h" |
Syntax
class FUtf8Iterator
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FUtf8Iterator
(
FUtf8Iterator&& |
Utf8/Utf8Iterator.h | ||
FUtf8Iterator
(
const FUtf8Iterator& |
Utf8/Utf8Iterator.h | ||
FUtf8Iterator
(
FUtf8StringView InView |
Construct an iterator positioned at the start of the given UTF-8 view. | Utf8/Utf8Iterator.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ReplacementCharacter | UTF32CHAR | The Unicode replacement character emitted for any invalid or truncated sequence. | Utf8/Utf8Iterator.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CachedCodepoint | UTF32CHAR | Utf8/Utf8Iterator.h | ||
| Pos | const UTF8CHAR * | Utf8/Utf8Iterator.h | ||
| ViewEnd | const UTF8CHAR * | Utf8/Utf8Iterator.h |
Functions
Public
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
operator bool() |
Returns true while the iterator is positioned at a valid codepoint. | Utf8/Utf8Iterator.h | |
UTF32CHAR operator*() |
Returns the codepoint at the current position. Only valid when operator bool() returns true. | Utf8/Utf8Iterator.h | |
void operator++() |
Advance to the next codepoint. | Utf8/Utf8Iterator.h | |
void operator++
(
int |
Utf8/Utf8Iterator.h | ||
FUtf8Iterator & operator=
(
const FUtf8Iterator& |
Utf8/Utf8Iterator.h | ||
FUtf8Iterator & operator=
(
FUtf8Iterator&& |
Utf8/Utf8Iterator.h |