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>ENCConvertToInternalEncoding</title>
8</head>
9<body>
10
11<h1>ENCConvertToInternalEncoding</h1>
12
13<h2>Syntax</h2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/enc.h&gt;
16
17ENCResult ENCConvertToInternalEncoding(ENCContext* context, u16* dst, s32* dstlen, const u8* 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. 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. 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. Strings of sizes larger than specified by <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 external character encoding to an internal character encoding.</p>
51<p>
52This 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>
53<p>
54If 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> is the byte conversion buffer size.</font></p>
55<p>
56<font color="ff0000">Because the character code conversion context stores the conversion state, the same context has to be used to resume a conversion terminated midway.<br> Unless a terminated conversion is being resumed, the context has to be initialized.</font>
57</p>
58<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>
59
60<h2>See Also</h2>
61<p class="reference">
62  <a href="ENCInitContext.html">ENCInitContext</a>,
63  <a href="ENCDuplicateContext.html">ENCDuplicateContext</a>
64</p>
65
66<h2>Revision History</h2>
67<p>
682008/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>
69</p>
70
71<hr><p>CONFIDENTIAL</p></body>
72</html>