Troubleshooting
Problem
CPYTOIMPF does not add BOM codes to a UTF-8 streamfile to clearly identify it as a UTF-8 file on other platforms. This document includes information on how to add them.
Resolving The Problem
CPYTOIMPF does not add BOM codes to a UTF-8 streamfile to clearly identify it as a UTF-8 file on other platforms. This document includes information on how to add them.
CPYTOIMPF was used to create an export streamfile in UTF-8 (CCSID 1208) format. When the file contained special characters such as umlauts, the receiving application correctly identified the UTF-8 encoding. However, with only plain Latin characters, the target application assumed ANSI encoding and refused the import. BOM characters (see Byte Order Mark (BOM) FAQ) were missing to uniquely identify the field contents.
The following are valid BOM characters:
You should do the following to correct this issue:
CPYTOIMPF was used to create an export streamfile in UTF-8 (CCSID 1208) format. When the file contained special characters such as umlauts, the receiving application correctly identified the UTF-8 encoding. However, with only plain Latin characters, the target application assumed ANSI encoding and refused the import. BOM characters (see Byte Order Mark (BOM) FAQ) were missing to uniquely identify the field contents.
The following are valid BOM characters:
| BOMS | Hex values |
| UTF-32 BE (020) | 00 00 FE FF |
| UTF-32 LE (030) | FF FE 00 00 |
| UTF-16 BE (040) | FE FF |
| UTF-16 LE (050) | FF FE |
| UTF-8 (060) | EF BB BF |
You should do the following to correct this issue:
| 1. | Create a UTF-8 streamfile with the correct UTF-8 BOM characters X'EFBBBF'. (make sure the STMF is CCSID 1208 and the contents is unchanged): Windows Notepad can be used to generate that file. You should open a new, empty file and use Save As to specify UTF-8 format: ![]() |
| 2. | Type the following ahead of the export file: CPY OBJ('utf8bom.txt') TOOBJ('newfile.txt') FROMCCSID(1208) TOCCSID(1208) REPLACE(*YES) CPYTOIMPF FROMFILE(<Table>) TOSTMF('newfile.txt') STMFCCSID(1208) (or for V5R4: STMFCODPAG(1208)) MBROPT(*ADD) |
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CQHAA2","label":"IBM i Db2-\u003ECCSID"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
629017082
Was this topic helpful?
Document Information
Modified date:
12 December 2024
UID
nas8N1011066
