### Initializing iconv_open for Character Set Conversion in C Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconv_open.3.html The `iconv_open` function allocates a conversion descriptor for converting byte sequences from `fromcode` to `tocode`. It requires including `` and takes two constant character pointers specifying the source and target encodings. The function returns a valid `iconv_t` descriptor on success or `(iconv_t)(-1)` on error, setting `errno`. ```C #include iconv_t iconv_open (const char* _tocode_, const char* _fromcode_); ``` -------------------------------- ### Listing Supported Encodings using iconv Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconv.1.html This command lists all character encodings supported by the `iconv` implementation on the system. It is useful for identifying available source and target encodings for conversion operations. ```Shell iconv --list ``` -------------------------------- ### Initializing Character Set Conversion Descriptor with iconv_open_into in C Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconv_open_into.3.html This C function `iconv_open_into` initializes a conversion descriptor suitable for converting byte sequences from `fromcode` to `tocode`. The descriptor is stored in the memory pointed to by `resultp`, which can then be used as an `iconv_t` object with the `iconv` function. It returns 0 on success and -1 on error, setting `errno`. ```C #include int iconv_open_into (const char* tocode, const char* fromcode, iconv_allocation_t* resultp); ``` -------------------------------- ### Declaring iconvctl Function in C Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconvctl.3.html This snippet shows the function signature for `iconvctl`, which is used to query or adjust the behavior of an `iconv` conversion descriptor. It requires the `iconv.h` header and takes a conversion descriptor, a request type, and an argument pointer. ```C #include int iconvctl (iconv_t cd, int request, void * argument); ``` -------------------------------- ### Performing Character Set Conversion with iconv in C Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconv.3.html The `iconv` function converts multibyte character sequences from an input buffer to an output buffer, updating pointers and byte counts. It can also reset the conversion state or store shift sequences. The function requires a conversion descriptor (`cd`) obtained from `iconv_open`. It returns the number of non-reversible conversions or `(size_t)(-1)` on error, setting `errno` to indicate issues like invalid sequences (EILSEQ), incomplete sequences (EINVAL), or insufficient output buffer space (E2BIG). ```C #include size_t iconv (iconv_t cd, const char* * inbuf, size_t * inbytesleft, char* * outbuf, size_t * outbytesleft); ``` -------------------------------- ### Checking libiconv Version in C Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconvctl.3.html This code snippet demonstrates how to check for the presence of the `iconvctl` function, which is specific to GNU libiconv. It uses the `_LIBICONV_VERSION` macro to determine if the library version is 0x0108 or newer. ```C (_LIBICONV_VERSION >= 0x0108) ``` -------------------------------- ### Converting KOI8-R with Substitution using iconv Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconv.1.html This command converts input from the KOI8-R (old Russian) encoding to the locale's encoding. It demonstrates advanced error handling by substituting invalid bytes and unconvertible Unicode characters with hexadecimal representations using format strings. ```Shell iconv -f KOI8-R --byte-subst="<0x%x>" \ --unicode-subst="" ``` -------------------------------- ### Closing an iconv Conversion Descriptor in C Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconv_close.3.html This C code snippet illustrates the function signature for `iconv_close`. It is used to deallocate an `iconv_t` conversion descriptor, `cd`, which was previously allocated by `iconv_open`. The function returns 0 on success and -1 on error, setting `errno`. ```C #include int iconv_close (iconv_t cd); ``` -------------------------------- ### Converting ISO-8859-1 to UTF-8 using iconv Source: https://github.com/nvidia-omniverse/ext-libiconv/blob/main/man/iconv.1.html This command converts text from the ISO-8859-1 (old West-European) encoding to UTF-8 (Unicode). It is a fundamental operation for migrating or standardizing character sets. ```Shell iconv -f ISO-8859-1 -t UTF-8 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.