Group PJ_UNICODE

group PJ_UNICODE

Defines

PJ_DECL_UNICODE_TEMP_BUF(var, size)

This macro is used to declare temporary Unicode buffer for ANSI to Unicode conversion, and should be put in declaration section of a block. When PJ_NATIVE_STRING_IS_UNICODE macro is not defined, this macro will expand to nothing.

PJ_STRING_TO_NATIVE(s, buf, max)

This macro will convert ANSI string to native, when the platform’s native string is Unicode (PJ_NATIVE_STRING_IS_UNICODE is non-zero).

PJ_DECL_ANSI_TEMP_BUF(buf, size)

This macro is used to declare temporary ANSI buffer for Unicode to ANSI conversion, and should be put in declaration section of a block. When PJ_NATIVE_STRING_IS_UNICODE macro is not defined, this macro will expand to nothing.

PJ_NATIVE_TO_STRING(cs, buf, max)

This macro will convert Unicode string to ANSI, when the platform’s native string is Unicode (PJ_NATIVE_STRING_IS_UNICODE is non-zero).

Functions

wchar_t *pj_ansi_to_unicode(const char *str, int len, wchar_t *wbuf, int wbuf_count)

Convert ANSI strings to Unicode strings.

Parameters:
  • str – The ANSI string to be converted.

  • len – The length of the input string.

  • wbuf – Buffer to hold the Unicode string output.

  • wbuf_count – Buffer size, in number of elements (not bytes).

Returns:

The Unicode string, NULL terminated.

char *pj_unicode_to_ansi(const wchar_t *wstr, pj_ssize_t len, char *buf, int buf_size)

Convert Unicode string to ANSI string.

Parameters:
  • wstr – The Unicode string to be converted.

  • len – The length of the input string.

  • buf – Buffer to hold the ANSI string output.

  • buf_size – Size of the output buffer.

Returns:

The ANSI string, NULL terminated.