ENCConvertFromInternalEncoding

Syntax

#include <revolution/enc.h>

ENCResult ENCConvertFromInternalEncoding(ENCContext* context, u8* dst, s32* dstlen, const u16* src, s32* srclen);

Arguments

context Character code conversion context.
dst Destination buffer of the converted string.
Termination character will not be attached. If dst is NULL, the string will not be written.
dstlen Destination buffer size of the converted string.
After conversion, the size written to the buffer will be stored. When
dst is NULL, the destination buffer size will be ignored and the buffer size necessary for writing the converted string will be stored.
src The source string buffer.
srclen Size of the source string buffer. A string larger than srclen will not be read.
If srclen has a negative value, src will be loaded until the termination character is found.

Return Values

ENC_OK: Normal exit.
ENC_ERR_NO_BUF_LEFT: Insufficient size of the destination buffer.
ENC_ERR_NO_MAP_RULE: Detected unconvertible character.
ENC_ERR_INVALID_PARAM: Invalid argument.
ENC_ERR_INVALID_FORMAT: Detected a character unsupported by the input character code.
ENC_ERR_UNKNOWN_ENCODING: Unknown character encoding.
ENC_ERR_UNSUPPORTED: Unsupported character code conversion.

Description

Converts from internal character encoding to an external character encoding.

This function converts the encoding of a given string and obtains the size of the buffer where the converted string was written.
A termination character does not get attached.

If the destination buffer is not specified, the buffer size necessary for the write operation will be obtained.
If a character that cannot be converted is detected, ENC_ERR_NO_MAP_RULE is returned and the conversion process ends.
dstlen and srclen represent the byte conversion buffer size.

Because the character code conversion context stores the conversion state, the same context has to be used when resuming a conversion terminated midway.
Unless a terminated conversion is being resumed, the context has to be initialized.

ENC_ERR_NOT_LOADED was eliminated in RevolutionSDK 3.2.
If you specify conversion to a character code whose conversion table has been stripped, this function will return ENC_ERR_UNSUPPORTED.

See Also

ENCInitContext, ENCDuplicateContext

Revision History

2008/07/08 Revised the description of the buffer size.
2008/03/31 Eliminated ENC_ERR_NOT_LOADED.
2007/02/05 Added ENC_ERR_NOT_LOADED.
2006/10/19 Initial version.


CONFIDENTIAL