ImageGear for C and C++ on Windows v19.8 - Updated
IG_REC_util_unicode_to_codepage
API Reference Guide > Recognition Component API Reference > Recognition Component Functions Reference > Utility Functions > IG_REC_util_unicode_to_codepage

Converts a UNICODE character code to its representation in the current code page.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_REC_util_unicode_to_codepage(
   AT_WCHAR Unicode,
   LPAT_BYTE pCodePageBuffer,
   AT_INT codepageBufferLength
);

Arguments:

Name Type Description
Unicode AT_WCHAR Character code to be converted.
pCodePageBuffer LPAT_BYTE Pointer of a variable to store the result of the conversion.
codepageBufferLength AT_INT Length of the output buffer. Must be large enough to hold the converted character.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
AT_ERRCOUNT ErrCount = 0;
HIGEAR higImage = 0;
HIG_REC_IMAGE higRecImage = 0;
LPAT_BYTE lpBuffer = 0;
AT_INT iBufLen = 0;
AT_WCHAR wcUnicode = L'�';
AT_INT iActualLen = 0;

ErrCount += IG_load_file("Image.tif", &higImage);
ErrCount += IG_REC_image_import(higImage, &higRecImage);
ErrCount += IG_REC_image_recognize(higRecImage);

ErrCount += IG_REC_output_codepage_set("Windows ANSI");
ErrCount += IG_REC_util_unicode_to_codepage_length_get(wcUnicode, &iActualLen);
lpBuffer = (LPAT_BYTE) malloc(iActualLen);
ErrCount += IG_REC_util_unicode_to_codepage(wcUnicode, lpBuffer, iActualLen);
//...

free(lpBuffer);
ErrCount += IG_REC_image_delete(higRecImage);
ErrCount += IG_image_delete(higImage);

Remarks:

The current Code Page can be changed by a previous IG_REC_output_codepage_set function call. The length of the output character can be retrieved with the IG_REC_util_unicode_to_codepage_length_get function call.