<doc>
	<legacy_id></legacy_id>
	<name>textEncode</name>
	<type>function</type>

	<syntax>
		<example>textEncode(<i>stringToEncode, encoding</i>)</example>
	</syntax>

	<synonyms>
	</synonyms>

	<summary>Converts from text to binary data.</summary>

	<examples>
<example>textEncode("A","UTF16")</example>
<example><p>put textEncode(field "output","UTF-8") into tOutput</p><p>put tOutput into url ("file:output.txt")</p></example>
	</examples>

	<history>
		<introduced version="7.0">Added.</introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		<changed version=""></changed>
		<experimental version=""></experimental>
		<nonexperimental version=""></nonexperimental>
	</history>

	<objects>
	</objects>

	<platforms>
		<mac/>
		<windows/>
		<linux/>
		<ios/>
		<android/>
	</platforms>

	<classes>
		<desktop/>
		<server/>
		<web/>
		<mobile/>
	</classes>

	<security>
	</security>


	<classification>
	</classification>

	<references>
		<function tag="textDecode">textDecode function</function>
	</references>

	<description>
	<overview>Converts from text to binary data.</overview>

		<parameters>
  <parameter>
    <name>stringToEncode</name>
    <description>Any string, or expression that evaluates to a string.</description>
  </parameter>
  <parameter>
    <name>encoding</name>
    <description>the encoding to be used</description>
    <options title="">
      <option>
        <item>ASCII</item>
        <description/>
      </option>
      <option>
        <item>ISO-8859-1</item>
        <description>Linux only</description>
      </option>
      <option>
        <item>MacRoman</item>
        <description>OS X only</description>
      </option>
      <option>
        <item>Native</item>
        <description>ISO-8859-1 on Linux, MacRoman on OS X, CP1252 on Windows</description>
      </option>
      <option>
        <item>UTF-16</item>
        <description/>
      </option>
      <option>
        <item>UTF-16BE</item>
        <description/>
      </option>
      <option>
        <item>UTF-16LE</item>
        <description/>
      </option>
      <option>
        <item>UTF-32</item>
        <description/>
      </option>
      <option>
        <item>UTF-32BE</item>
        <description/>
      </option>
      <option>
        <item>UTF-32LE</item>
        <description/>
      </option>
      <option>
        <item>UTF-8</item>
        <description/>
      </option>
      <option>
        <item>CP1252</item>
        <description/>
      </option>
    </options>
  </parameter>		</parameters>

	<value>Returns the <i>stringToEncode</i> as binary data.</value>
	<comments>The <b>textEncode</b> function takes text, and returns it as binary data, encoded with the specified encoding.<p></p><p>It is highly recommended that any time you interface with things outside LiveCode (files, network sockets, processes, etc) that you explicitly <function tag="textEncode">textEncode</function> any text you send outside LiveCode and <function tag="textDecode">textDecode</function> all text received into LiveCode. If this doesnt happen, a platform-dependent encoding will be used (which normally does not support Unicode text).</p><p></p><p>It is not, in general, possible to reliably auto-detect text encodings so please check the documentation for the programme you are communicating with to find out what it expects. If in doubt, try UTF-8.</p></comments>
	</description>
</doc>