SDL_iconv_string(3)

SDL_iconv_string3

Helper function to convert a string's encoding in one call.

Usage

#include "SDL3/SDL.h"

char * SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);

Header file

Defined in SDL3/SDL_stdinc.h

Overview

This function converts a buffer or string between encodings in one pass.

The string does not need to be NULL-terminated; this function operates on the number of bytes specified in inbytesleft whether there is a NULL character anywhere in the buffer.

The returned string is owned by the caller, and should be passed to

SDL_free
when no longer needed.

Function parameters

tocode

the character encoding of the output string. Examples are "UTF-8", "UCS-4", etc.

fromcode

the character encoding of data in inbuf .

inbuf

the string to convert to a different encoding.

inbytesleft

the size of the input string _in bytes_.

Return value

Returns a new string, converted to the new encoding, or NULL on error.

Availability

This function is available since SDL 3.2.0.

From libsdl3-doc 3.2.10+ds-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.