TextEncode
Returns a text file as container data from text using the specified character encoding and line endings.
Format
TextEncode ( text ; encoding ; lineEndings )
Parameters
text
- any text expression or field.
encoding
- the name of the character encoding to use (see below).
lineEndings
- a number that specifies the line endings to use (see below). If not specified, line endings are left unchanged.
Data type returned
container
Originated in version
16.0
Description
For the encoding
parameter, use one of the following names to specify the character encoding. If you use no value or an unrecognized value, this function returns "?".
|
Encodes text using |
|
Unicode |
|
Latin 1 |
|
Cyrillic |
|
Japanese |
|
Windows |
|
Simplified Chinese |
|
Korean |
|
Traditional Chinese |
|
Mac Roman |
For the lineEndings
parameter, use one of the following values to specify the line endings to use. If you use an unrecognized value, line endings are unchanged.
|
Changes line endings to |
|
Unchanged |
|
Carriage return (legacy Mac standard) |
|
Line feed (modern Mac, Unix/Linux standard) |
|
Carriage return followed by a line feed (Windows standard) |
Example 1
Returns a text file as container data from a text field using Japanese character encoding and leaves line endings unchanged.
TextEncode ( table::text ; "shift_jis" ; 1 )
Example 2
Converts the contents of a text field to ISO-8859-1 character encoding and Windows line endings, then exports the resulting container field as a text file.
Set Field [ table::container ; TextEncode ( table::text ; "iso-8859-1" ; 4 ) ]
Export Field Contents [ table::container ; "output.txt" ; Create folders: Off]