Translate characters from UTF-8
#include <photon/PxProto.h>
int PxTranslateFromUTF( struct PxTransCtrl *ctrl,
const char *src,
int maxsrc,
int *srctaken,
char *dst,
int maxdst,
int *dstmade);
PxTranslateFromUTF() is used to translate a block of characters
from UTF-8
(the internal Photon character set). The ctrl parameter specifies
the
encoding of the destination 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 UTF-8 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 the current encoding.
- 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 encoded 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 UTF-8 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)
into 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 sequence would be incomplete).
- 0
- Success.
- -1
- An error occurred.
Photon
Safety: | |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
PxTranslateList(),
PxTranslateSet(),
PxTranslateStateFromUTF(),
PxTranslateStateToUTF(),
PxTranslateToUTF(),
PxTranslateUnknown()
Unicode Multilingual Support
in the Photon Programmer's Guide
mbtowc(),
wctomb()
in the Watcom C Library Reference