Encoding issues with UTF-8 files on z/OS for shell command

dan.glunz
Fri, 22 Sep 2023 15:48:18 +0000
Get Help

Hi,

our latest z/OS system has been upgraded with Python 3.11 and IZOAU 1.2.3 and we have upgraded our ibm_zos_core collection to 1.6.0 from 1.4.0 (and even tried out the new 1.7.0-beta2) release.
Now we have encoding issues with a specific shell command. We are not sure if this is really related to the ibm_zos_core upgraded and if this is the correct place to ask for support, but as we haven’t found any other place we try doing it here:

We have the following task that is being executed on the z/OS system (managed node/target):

    - name: Deploy broker
      shell:
        cmd: ". /u/user/.profile && java -jar brokerhelper.jar -file /u/user/brokerhelper.xml"
        chdir: "/u/user"
        executable: "/bin/bash"

The file brokerhelper.xml has UTF-8 encoding on the file system and the utility brokerhelper.jar expects the file brokerhelper.xml to be in UTF-8.
The brokerelper.xml prolog contains the xml definition like this:
<?xml version="1.0" encoding="UTF-8"?>

However, when the shell command is being executed the file brokerhelper.xml is being converted by ansible to EBCDIC and the brokerhelper.jar gets that xml file in ebcdic encoding. We do not want that this happens.

We have tried out the following:

1. we have disabled pipeling in ansible.cfg and do not set the PYTHONSTDINENCODING variable.

2. We have tried setting the PYTHONSTDINENCODING with pipeling and this does also not help.

3. We have tried out to use zos_encode and convert the already stored as UTF-8 file on the z/OS system to UTF-8 again and it does make thins even worse:

      ibm.ibm_zos_core.zos_encode:
        src: "/u/user/brokerhelper.xml"
        encoding:
          from: "UTF-8"
          to: "IBM-1047"
        backup: yes

Any ideas what might help?
Any help appreciated.
Thanks.

4 posts - 3 participants