Search code examples
bashjarcharacter-encodingzipzos

After unzipping on z/OS USS within bash, what is the command to convert an sh script to the right code page?


My problem is the charset of the files that get unzip within bash are not UTF8. Here are the steps to reproduce the problem:

  1. Copy a zip file in binary to USS (ftp - bin - put myfile2unzip.zip)
  2. Use the jar command to unzip: jar -xvf myfile2unzip.zip
  3. cat myscript.sh

Output:

{Za???a????{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{@???@....

What I have tried:

iconv -f UTF8 -t IBM1047 myscript.sh > myscript.uss

That did not work, the output file has the wrong charset.


Solution

  • The jar command in bash was unzipping the files in charset: ISO8859-1 The jar command in sh unzips the files into UTF8.

    So the right command in bash is: iconv -f ISO8859-1 -t UTF8 myscript.sh > myscript.uss