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>C Specification</h2> 14<dl> 15<dd><pre><code>#include <revolution/enc.h></code></pre> 16 </dd> 17<dd><pre><code>ENCResult ENCConvertToInternalEncoding(ENCContext* <em>context</em>, u16* <em>dst</em>, s32* <em>dstlen</em>, const u8* <em>src</em>, s32* <em>srclen</em>);</code></pre> 18 </dd> 19</dl> 20 21<h2>Arguments</h2> 22<table border="1" cellpadding="3" cellspacing="0.1"> 23 <tr> 24<td valign="top" width="120" bgcolor="#ffffe8"><em><strong><code>context</code></strong></em></td> 25<td width="520">Character code conversion context.</td> 26 </tr> 27 <tr> 28<td valign="top" width="120" bgcolor="#ffffe8"><em><strong><code>dst</code></strong></em></td> 29<td width="520">The destination buffer of the converted string.<br />The termination character will not be attached.<br />If <code>dst</code> is NULL, the string will not be written.</td> 30 </tr> 31 <tr> 32<td valign="top" width="120" bgcolor="#ffffe8"><em><strong><code>dstlen</code></strong></em></td> 33<td width="520">The destination buffer size of the converted string.<br />After conversion, the size written to the buffer will be stored.<br />When <code>dst</code> is NULL, the destination buffer size will be ignored,<br />and the buffer size necessary for writing the converted string will be stored.</td> 34 </tr> 35 <tr> 36<td valign="top" width="120" bgcolor="#ffffe8"><code><em><strong>src</strong></em></code></td> 37<td width="520">The source string buffer.</td> 38 </tr> 39 <tr> 40<td valign="top" width="120" bgcolor="#ffffe8"><code><em><strong>srclen</strong></em></code></td> 41<td width="520">The source string buffer size. A string larger than specified by <code>srclen</code> will not be read.<br />If <code>srclen</code> has a negative value, <code>src</code> will be read until the termination string is found.</td> 42 </tr> 43</table> 44 45<h2>Return Values</h2> 46 47<p> 48<code>ENC_OK</code>: Successful termination<br /> <code>ENC_ERR_NO_BUF_LEFT</code>: Destination buffer size insufficient<br /> <code>ENC_ERR_NO_MAP_RULE</code>: Unconvertible character detected<br /> <code>ENC_ERR_INVALID_PARAM</code>: Invalid arguments<br /> <code>ENC_ERR_INVALID_FORMAT</code>: Character not specified as a valid input character code detected<br /> <code>ENC_ERR_UNKNOWN_ENCODING</code>: Unidentifiable character encoding<br /> <code>ENC_ERR_UNSUPPORTED</code>: Unsupported character code conversion<br /><code>ENC_ERR_NOT_LOADED</code>: The necessary data is not loaded<br /> 49</p> 50 51<h2>Description</h2> 52<p>Converts from external character encoding to an internal character encoding.</p> 53<p>This function converts the encoding of a given string and obtains the length of the buffer where the converted string was written.<br />A termination character does not get attached.</p> 54<p>If the destination buffer is not specified, the buffer length 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"><code><em>dstlen</em></code> and <code><em>srclen</em></code> is the byte conversion buffer size.</font></p> 55<p><font color="ff0000">Because the character code conversion context stores the conversion state, the same context needs to be used when resuming a conversion terminated midway.<br /> Also, unless resuming a terminated conversion, the context needs to be initialized.</font></p> 56 57<h2>See Also</h2> 58<p> 59<a href="ENCInitContext.html"><code>ENCInitContext</code></a><br /> <a href="ENCDuplicateContext.html"><code>ENCDuplicateContext</code></a> 60</p> 61 62<h2>Revision History</h2> 63<p>2007/02/05 Added <CODE>ENC_ERR_NOT_LOADED</CODE>.<br />2006/10/26 Initial version.</p> 64<br /><br /> 65<hr> 66<P>CONFIDENTIAL</p> 67</BODY> 68</HTML>