---
name: "SDL_StepBackUTF8"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_StepBackUTF8"
---

# SDL\_StepBackUTF8(3)

Decode a UTF-8 string in reverse, one Unicode codepoint at a time.

## NAME

SDL\_StepBackUTF8 - Decode a UTF-8 string in reverse, one Unicode codepoint at a time.

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**Uint32 SDL\_StepBackUTF8(const char \*start, const char \*\*pstr);**

## DESCRIPTION

This will go to the start of the previous Unicode codepoint in the string, move *pstr* to that location and return that codepoint.

If pstr is already at the start of the string), it will not advance **\*pstr** at all.

Generally this function is called in a loop until it returns zero, adjusting its parameter each iteration.

If an invalid UTF-8 sequence is encountered, this function returns

**SDL\_INVALID\_UNICODE\_CODEPOINT** .

Several things can generate invalid UTF-8 sequences, including overlong encodings, the use of UTF-16 surrogate values, and truncated data. Please refer to

RFC3629 ⟨URL: https://www.ietf.org/rfc/rfc3629.txt ⟩

for details.

## FUNCTION PARAMETERS

- *start*

  a pointer to the beginning of the UTF-8 string.

- *pstr*

  a pointer to a UTF-8 string pointer to be read and adjusted.

## RETURN VALUE

( **Uint32** ) Returns the previous Unicode codepoint in the string.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.
