Same as with displaying unicode you need to configure support for unicode on every level
- data (database or stream file)
- printer file
Unicode is supported by DDS and SQL. In SQL it needs to be declared as GRAPHIC or VARGRAPHIC with a corresponding CCSID. In DDS unicode field needs the graphic data type (G) and a corresponding CCSID, 1200 or 13488.
At the program level the variables need to be defined with a corresponding
dcl-s buffer char(1048576) ccsid(*utf8);
The fields in the record needs the data type GRAPHIC (G) and a corresponding CCSID, 1200 or 13488).
As the same printer file is used for multiple languages a unicode field is configure (with GRAPHIC data type) we don't want to convert the data to the CCSID of the printer file so we neet to add the parameter
A R I18NEXPR1 A LINE 60G 3SPACEB(1) A FONTNAME('Verdana' A (*POINTSIZE 12.0)) A CCSID(13488 *NOCONVERT)
The printer file needs *AFPDS as the device type and for testing we want to create a PDF from it.
CHGPRTF FILE(I18NEXP1) DEVTYPE(*AFPDS) TOSTMF('/home/mihael/unicode-test.pdf') WSCST(*PDF)
And now comes the tricky part. The font also needs to have a glyph for the unicode characters we used. So first a font with unicode characters is needed and the system has some requirements to it.
There are several pages in the IBM Knowledge Center about it.
I ended up put a true type font file into a folder in the IFS , /usr/local/fonts/ttf/ , and put that path to the env var with the following command:
ADDENVVAR ENVVAR(QIBM_FONT_RESOURCES_PATH) VALUE('/usr/local/fonts/ttf')