QNX Developer Support
|This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.|
Translate characters to UTF-8
#include <photon/PxProto.h> int PxTranslateToUTF( struct PxTransCtrl *ctrl, const char *src, int maxsrc, int *srctaken, char *dst, int maxdst, int *dstmade);
This function translates a block of characters to Unicode UTF-8 (the internal Photon character set). The ctrl parameter specifies the encoding of the source characters and must be the pointer returned by a previous call to PxTranslateSet() to install this encoding.
The parameters are as follows:
- A pointer to the buffer containing the source characters. If this is NULL, no translation is performed and the function returns the worst-case number of bytes required to hold a character in UTF-8 (MB_LEN_MAX == 3).
- The length of the contents in the source buffer (in bytes). No more than this number of bytes are read.
- A pointer to the buffer where the UTF-8 characters should be placed. If this is NULL, no data is copied but the translation is still performed to calculate the length required to store the converted data
- The length of the destination buffer (in bytes). No more than this number of bytes will be written; if this is 0, the buffer is assumed to be large enough to hold the entire encoding
- This must point to an integer, which will be updated to reflect the number of bytes consumed from the source buffer src. This value may be smaller than maxsrc (if the given destination buffer would overflow or if the final input character of a multibyte sequence is incomplete)
- This must point to an integer, which will be updated to reflect the number of bytes produced (or would be produced) in the destination buffer dst. This value may be smaller than maxdst (if the given source buffer is exhausted or if the final output character of a multibyte UTF-8 sequence would be incomplete).
- An error occurred.
Unicode Multilingual Support in the Photon Programmer's Guide