1<!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
5<meta http-equiv="Content-Style-Type" content="text/css" />
6<link rel="stylesheet" type="text/css" href="../../CSS/revolution.css" />
7<title>ENCConvertFromInternalEncoding</title>
8</head>
9<body>
10
11<h1>ENCConvertFromInternalEncoding</h1>
12
13<h2>Syntax</h2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/enc.h&gt;
16
17ENCResult ENCConvertFromInternalEncoding(ENCContext* context, u8* dst, s32* dstlen, const u16* src, s32* srclen);
18</pre></dd></dl>
19
20<h2>Arguments</h2>
21<TABLE class="arguments" border="1" >
22    <tr>
23<th>context</th>
24<td>Character code conversion context.</td>
25    </tr>
26    <tr>
27<th>dst</th>
28<td>Destination buffer of the converted string.<br>Termination character will not be attached. If <SPAN class="argument">dst</SPAN> is <CODE>NULL</CODE>, the string will not be written.</td>
29    </tr>
30    <tr>
31<th>dstlen</th>
32<td>Destination buffer size of the converted string.<br>After conversion, the size written to the buffer will be stored. When <br><SPAN class="argument">dst</SPAN> is <CODE>NULL</CODE>, the destination buffer size will be ignored and the buffer size necessary for writing the converted string will be stored.</td>
33    </tr>
34    <tr>
35<th>src</th>
36<td>The source string buffer.</td>
37    </tr>
38    <tr>
39<th>srclen</th>
40<td>Size of the source string buffer. A string larger than <SPAN class="argument">srclen</SPAN> will not be read.<br>If <SPAN class="argument">srclen</SPAN> has a negative value, <SPAN class="argument">src</SPAN> will be loaded until the termination character is found.</td>
41    </tr>
42</table>
43
44<h2>Return Values</h2>
45<p>
46<code>ENC_OK</code>: Normal exit.<br><code>ENC_ERR_NO_BUF_LEFT</code>: Insufficient size of the destination buffer.<br><code>ENC_ERR_NO_MAP_RULE</code>: Detected unconvertible character.<br><code>ENC_ERR_INVALID_PARAM</code>: Invalid argument.<br><code>ENC_ERR_INVALID_FORMAT</code>: Detected a character unsupported by the input character code.<br><code>ENC_ERR_UNKNOWN_ENCODING</code>: Unknown character encoding.<br><code>ENC_ERR_UNSUPPORTED</code>: Unsupported character code conversion.<br>
47</p>
48
49<h2>Description</h2>
50<p>Converts from internal character encoding to an external character encoding.</p>
51<p>This function converts the encoding of a given string and obtains the size of the buffer where the converted string was written.<br>A termination character does not get attached.</p>
52<p>
53If the destination buffer is not specified, the buffer size necessary for the write operation will be obtained.<br>If a character that cannot be converted is detected, <code>ENC_ERR_NO_MAP_RULE</code> is returned and the conversion process ends.<br><font color="ff0000"><SPAN class="argument">dstlen</SPAN> and <SPAN class="argument">srclen</SPAN> represent the byte conversion buffer size.</font></p>
54<p><font color="ff0000">Because the character code conversion context stores the conversion state, the same context has to be used when resuming a conversion terminated midway.<br> Unless a terminated conversion is being resumed, the context has to be initialized.</font></p>
55<p><b><code>ENC_ERR_NOT_LOADED</code> was eliminated in RevolutionSDK 3.2.</b><br>If you specify conversion to a character code whose conversion table has been stripped, this function will return <code>ENC_ERR_UNSUPPORTED</code>.</p>
56
57<h2>See Also</h2>
58<p class="reference">
59  <a href="ENCInitContext.html">ENCInitContext</a>,
60  <a href="ENCDuplicateContext.html">ENCDuplicateContext</a>
61</p>
62
63<h2>Revision History</h2>
64<p>
652008/07/08 Revised the description of the buffer size.<br>2008/03/31 Eliminated <code>ENC_ERR_NOT_LOADED</code>.<br>2007/02/05 Added <CODE>ENC_ERR_NOT_LOADED</CODE>.<br>2006/10/19 Initial version. <br>
66</p>
67
68<hr><p>CONFIDENTIAL</p></body>
69</html>