---
name: "SDL_utf8strlcpy"
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_utf8strlcpy"
---

# SDL\_utf8strlcpy(3)

Copy an UTF-8 string.

## NAME

SDL\_utf8strlcpy - Copy an UTF-8 string.

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

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

**size\_t SDL\_utf8strlcpy(char \*dst, const char \*src, size\_t dst\_bytes);**

## DESCRIPTION

This function copies up to **dst\_bytes**

• 1 bytes from **src** to **dst** while also ensuring that the string written to **dst** does not end in a truncated multi-byte sequence. Finally, it appends a null terminator. **src** and **dst** must not overlap.

Note that unlike  **SDL\_strlcpy** (), this function returns the number of bytes written, not the length of **src** .

## FUNCTION PARAMETERS

- *dst*

  The destination buffer. Must not be NULL, and must not overlap with **src** .

- *src*

  The null-terminated UTF-8 string to copy. Must not be NULL, and must not overlap with **dst** .

- *dst\_bytes*

  The length (in bytes) of the destination buffer. Must not be 0.

## RETURN VALUE

Returns the number of bytes written, excluding the null terminator.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_strlcpy**(3)](/SDL_strlcpy/3.md)
