Compartir a través de


Text Encoding

Text encoding is the process of transforming bytes of data into readable characters for users of a system or program. When you import a file as text or as a stream, the text encoding format ensures that all the language-specific characters are represented correctly in Microsoft Dynamics NAV. When you export a file as text or as a stream, the text encoding format ensures that all the language-specific characters are represented correctly in the system or program that will read the exported file.

Encoding Formats

You can specify text encoding for the following objects.

Object or data type For more information, see

XMLports

TextEncoding Property (XMLports)

File

OPEN Function (File)

BLOB

CREATEINSTREAM Function (BLOB)

CREATEOUTSTREAM Function (BLOB)

There are several industry text encoding formats and different systems support different formats. Internally, Microsoft Dynamics NAV uses Unicode encoding. For exporting and importing data with an XMLport, Microsoft Dynamics NAV supports MS-DOS, UTF-8, UTF-16, and Windows encoding formats. Data is imported and exported as follows:

  • When data is imported from an external file, it is read using the format that is specified by the TextEncoding property or parameter, and then converted to Unicode in Microsoft Dynamics NAV.

  • When data is exported to an external file, it is converted from Unicode in Microsoft Dynamics NAV, and then written to the file in the format that is specified by the TextEncoding property or parameter.

You should set the text encoding to the encoding format that is compatible with the system or program that you will be exporting to or importing from. The following sections describe the available text encoding formats.

MS-DOS Encoding Format

MS-DOS encoding, which is also referred to as OEM encoding, is an older format than UTF-8 and UTF-16, but it is still widely supported. MS-DOS encoding was the only format that was supported by earlier versions of Microsoft Dynamics NAV.

MS-DOS encoding requires a different character set for each language. When the property is set to MS-DOS, text is encoded by using the system locale language of the computer that is running Microsoft Dynamics NAV Server. So if you use MS-DOS encoding, you should set the system locale language of Microsoft Dynamics NAV Server to match the language of the data that is being imported or exported. For example, if an XMLport includes text in Danish, then you should set the system locale language of Microsoft Dynamics NAV Server to Danish before the XMLport is run.

You should choose MS-DOS with XMLports that were created in earlier versions of Microsoft Dynamics NAV.

UTF-8 Encoding Format

UTF-8 encoding is a Unicode Transformation Format that uses one byte (8 bits) to encode each character. UTF-8 is based on the Unicode character set, which includes most characters of all languages in a single character set.

Unlike MS-DOS, when you use UTF-8, you do not have to consider the language settings of Microsoft Dynamics NAV Server or the external system or program that will read or write the data.

UTF-8 is compatible with ASCII so that it will understand files written in ASCII format.

UTF-8 is the most common encoding format and the recommended setting if you are not sure of the format that is supported by the system that you are integrating with.

UTF-16 Encoding Format

UTF-16 encoding resembles UTF-8 except that UTF-16 uses 2 bytes (16 bits) to encode each character. UTF-16 is also based on the Unicode character set, so you do not have to consider the language setting of Microsoft Dynamics NAV Server or the external system or program that reads or writes the data.

UTF-16 includes two encoding schemes which mandate the byte order: UTF-16LE and UTF-16BE. Microsoft Dynamics NAV supports these schemes according to the following:

  • When exporting, the file is written using UTF-16LE encoding.

  • When importing, the file is read using the UTF-16, UTF-16LE, or UTF-16BE, depending on encoding scheme of the file itself.

A UTF-16 encoded file will typically be larger than the same file encoded with UTF-8, except for Eastern language character sets, which will typically be smaller.

UTF-16 is incompatible with ASCII so that it will not understand files written in ASCII format.

Windows Format

Windows encoding is also referred to as ANSI encoding. If you set the text encoding to Windows, you can import and export text files that are based on the Windows codepage on the user’s computer. As a result, you do not have to consider the language setting of Microsoft Dynamics NAV Server or the external system or program that reads or writes the data.

For example, if an XMLport can import bank files from a foreign bank in addition to a national bank, use Windows encoding instead of MS-DOS encoding to avoid changing the language of Microsoft Dynamics NAV Server.

Windows encoding is compatible with ASCII so that it will understand files written in ASCII format.

See Also

Reference

TextEncoding Property (XMLports)
OPEN Function (File)
CREATEINSTREAM Function (File)
CREATEOUTSTREAM Function (File)
CREATEINSTREAM Function (BLOB)
CREATEOUTSTREAM Function (BLOB)

Concepts

File Handling