Unicode Support (Magic xpi 4.13)

« Go Back


Created BySalesforce Service User
Approval Process StatusPublished

Unicode Support (Magic xpi 4.13)

Magic xpi lets you use the Unicode standard for data conversion and transmission. This capability is in addition to Magic xpi’s ANSI and OEM support. You can use Unicode when:

  • Sending and receiving Unicode data to and from external systems.

  • Reading and writing Unicode values in a database.

  • Handling Unicode in the Data Mapper.

  • Reading and handling Unicode data in flat files.

Unicode (UTF-16) content is loaded to the corresponding Unicode BLOB, and the BOM is removed in the process. If this BLOB is served as the HTTP response, it will not include the BOM. This may prevent the client from identifying the response's content encoding (Since version: 4.0a). It is therefore recommended that you process Unicode content in one of the following ways:

Unicode BLOBs do not hold BOMs as part of their data, since the BLOB is already identified as Unicode. An example of the above scenario is:

  1. Update a Unicode file’s BLOB using the File2Blb function, and in the Flow Data configuration window select Binary from the Encoding column’s drop-down list. Magic xpi will first load the content to a Unicode BLOB, removing the BOM in the process, and then update the binary BLOB with the content “as is”.

  2. You now have a binary BLOB with Unicode content but without a BOM. Use the Blb2File function to write the binary BLOB to the file system, and you will get a file with Unicode content but without a BOM.

If you save a Unicode BLOB to the file system, a BOM is automatically added to the new file.

  • In this version, the SAP A1, SAP ERP and SAP Business One components fully support Unicode. All other components support only ANSI in Step mode. If you process Unicode data for these components, the outcome is undetermined.

  • The Directory Scanner, HTTP, and Web Services components support Unicode in Trigger mode only.

  • Magic xpi treats all data saved in BLOBs as binary data. Therefore, in order to view Unicode data, use an application that supports Unicode, such as Notepad.

Unicode Functions

  • UnicodeChr: Converts a numeric value to its corresponding Unicode character.

  • UnicodeFromANSI: Converts an ANSI string to Unicode characters as determined by the selected code page.

  • UnicodeToANSI: Converts a Unicode string to ANSI characters as determined by the selected code page.

  • UnicodeVal: Converts a Unicode character to its corresponding numeric value.

  • UTF8fromUnicode: Converts a Unicode BLOB to a binary BLOB with UTF-8 content containing BOM characters.

  • UTF8toUnicode: Converts ANSI or a binary BLOB with UTF-8 content to a Unicode BLOB.

Unicode in the Data Mapper

Magic xpi's Unicode support means that you can use Unicode fields in database tables. nVarChar fields will be automatically treated as Unicode fields. In this case, the Internal Attribute node property will display Unicode instead of Alpha.

If you have a Unicode XML Source with a base64 field element you cannot directly map this element to a BLOB Destination. You first need to convert the base64 content into ANSI.

Unicode in the Expression Editor

The Expression Editor is fully Unicode-based.

  • The Blb2File function removes the BOM indication from Unicode files. Therefore, using this function for manipulation of Unicode data may provide unexpected results. To save the data in ANSI format, you must use the UnicodeToANSI function.

  • When you enter data into the Expression Editor, it is saved in Unicode. For example, when using the File Management component's Write File method, a hard coded string entered in the Data property will create a Unicode file. If you select a variable holding ANSI content for the Data property, an ANSI file will be created.

ODS, UDS and Unicode Conversion

Unicode based data stored in ODS and UDS variables is transparently treated and saved as Unicode. All UDS and ODS functions transparently support Unicode data.

Related Topics