ENCConvertToInternalEncoding

Syntax

#include <revolution/enc.h>

ENCResult ENCConvertToInternalEncoding(ENCContext* context, u16* dst, s32* dstlen, const u8* 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. Strings of sizes larger than specified by 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 external character encoding to an internal 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 is the byte conversion buffer size.

Because the character code conversion context stores the conversion state, the same context has to be used to resume 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