DCMTK: oficonv: a character set conversion library

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
oficonv: a character set conversion library

This module contains the Citrus iconv implementation in a modified version adapted for use in DCMTK and with the character set encodings used in the DICOM standard.

The most important functions are:

- OFiconv_open()
- OFiconv()
- OFiconv_close()

# Examples

The following example shows a very simple character set conversion. Most error handling code has been omitted for brevity.

// we want to convert from ISO 8859-1 to UTF-8
iconv_t id = OFiconv_open("UTF-8", "ISO-8859-1");
if (id != OFreinterpret_cast(iconv_t, -1))
{
// set up input and output buffer
char output[20];
char input[20];
strcpy(input, "J\xF6rg");
// set up the parameters for OFiconv
char *src_ptr = input; // Following the Posix spec, this pointer is not const
size_t src_len = std::strlen(src_ptr);
char *dst_ptr = output;
size_t dst_len = 20;
// perform the conversion
size_t result = OFiconv(id, &src_ptr, &src_len, &dst_ptr, &dst_len);
if (result != OFstatic_cast(size_t, -1))
{
std::cout << "UTF-8 string: " << output << std::endl;
}
// close the conversion descriptor
OFiconv_close(id);
}
OFiconv
DCMTK_OFICONV_EXPORT size_t OFiconv(iconv_t cd, char **src, size_t *srcleft, char **dst, size_t *dstleft)
convert the string in the buffer *src of length *srcleft bytes and stores the converted string in the...
OFiconv_close
DCMTK_OFICONV_EXPORT int OFiconv_close(iconv_t cd)
close the specified converter cd
OFiconv_open
BEGIN_EXTERN_C DCMTK_OFICONV_EXPORT iconv_t OFiconv_open(const char *dstname, const char *srcname)
open a converter from the codeset srcname to the codeset dstname and returns its descriptor.

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2