PxTranslateUnknown()

Control how unknown encodings are handled

Synopsis:

#include <photon/PxProto.h>

int PxTranslateUnknown( struct PxTransCtrl *ctrl,
                        uint16_t to,
                        uint16_t from );

Library:

phexlib

Description:

This function controls the behavior of the encoding routines when they encounter an invalid byte sequence or a character that can't be represented in the current encoding scheme.

The ctrl argument is a pointer to the control structure for a character set translation returned from a previous call to PxTranslateSet().

The to argument is used when converting to UTF-8 by calling PxTranslateToUTF() or PxTranslateStateToUTF(). If to is 0 (the default) and an invalid encoding is encountered, the translation is halted and returns an error. If to is nonzero, it's the Unicode character to insert into the translation instead of the invalid one.

The from argument is similar, but is used when converting from UTF-8 by calling PxTranslateFromUTF() or PxTranslateStateFromUTF().

Returns:

0
Success.
-1
An error occurred.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PxTranslateFromUTF(), PxTranslateSet(), PxTranslateStateFromUTF(), PxTranslateStateToUTF(), PxTranslateToUTF()

Unicode Multilingual Support in the Photon Programmer's Guide