Unicode Support (Magic xpi 4.7)
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:
-
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”.
-
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 R/3 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.
|
Magic xpi provides the following 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.
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.
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.
|
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.
Content Encoding Handling