Encodig converter - Examples
Encoding a file to CSV, ready for Excel
One of the questions we get is the problem of reading the files, created by a File Drop, into Excel. The problem with these files is that they are written in UTF-8 encoding. Excel will have some problems with these files if there are special characters in these files. For instance the german city Düsseldorf will be displayed as DÃ¼sseldorf in Excel.
We must understand that Microsoft is using the systems Language and Region settings to select the correct encoding for its system. So check your system for the correct encoding.
We will use the next use-case. We have a file in UTF-8 encoding. This file is a .csv file. Wil will pick this file up, use a encoder converter service and drop the file in an output directory.
- You can download the interface here.
- You need a license for ConnectPlaza Control
Unzip the file and install the interface by creating a new Business Connector with the name Demo-EncodingConverterInterface (for example) and import the interface via the Create new interface window.
Select the Demo-EncodingConverter.cinterface file and press Save to upload the file into the system.
Business connector / Interface and Flows
How it works
First we start the interface. After starting up there will be an input and an output directory available in your ConnectPlaza Agent installation directory. Copy the file cpTestFile.csv into the input directory. Check if the file is picked up, you will see the file dissapear from the input directory.
Now we check the output directory. You will find a .csv file there, try to open this file with Excel. If all is well there should be no problem at all.
Dealing with UTF16 or UTF32 Encoding.
When attempting to convert documents that are either UTF16-LE or UTF16-BE or UTF32, it is no longer possible to handle these documents using Text messageparts, as the default encoding for the ConnectPlaza Agent is set to UTF-8. You can change this setting to match your default encoding and update it to UTF16 or higher. This may have impact on dealing with documents that are in different encodings so please be careful.
Otherwise you can handle UTF16-LE/BE or UTF-32 documents by handling them as Bytes messageparts. These messageparts contain the byte representation of the encoded text. This can be achieved by reading a file to Bytes by specifying this in the 'Response message Type'. The Encoding Converter service will automatically detect the bytestream and can convert accordingly.