QNX Developer Support
![]() |
![]() |
![]() |
![]() |
PxTranslateToUTF()
Translate characters to UTF-8
Synopsis:
#include <photon/PxProto.h>
int PxTranslateToUTF( struct PxTransCtrl *ctrl,
const char *src,
int maxsrc,
int *srctaken,
char *dst,
int maxdst,
int *dstmade);
Library:
phexlib
Description:
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:
- src
- 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).
- maxsrc
- The length of the contents in the source buffer (in bytes). No more than this number of bytes are read.
- dst
- 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
- maxdst
- 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
- srctaken
- 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)
- dstmade
- 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).
Returns:
- 0
- Success.
- -1
- An error occurred.
Classification:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
See also:
PxTranslateList(), PxTranslateFromUTF(), PxTranslateSet(), PxTranslateStateFromUTF(), PxTranslateStateToUTF(), PxTranslateUnknown()
Unicode Multilingual Support in the Photon Programmer's Guide
mbtowc(), wctomb() in the QNX Neutrino Library Reference
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)
