Skip to main content

SDL_iconv_string

Function SDL_iconv_string 

Source
pub unsafe extern "C" fn SDL_iconv_string(
    tocode: *const c_char,
    fromcode: *const c_char,
    inbuf: *const c_char,
    inbytesleft: usize,
) -> *mut c_char
Expand description

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

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.

§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.

§Thread safety

It is safe to call this function from any thread.

§Availability

This function is available since SDL 3.2.0.

§See also