Troubleshooting
Problem
inputStreamReader is not picking up the encoding set by way of a -Dfile.encoding property. The user specified input file is not being read using the encoding set by the property -Dfile.encoding As a result, it is read with default ASCII or EBCDIC encoding.
Cause
In z/OS, inputStreamReader is handled by the system properties -Dibm.ascii.encoding and -Dibm.ebcdic.encoding as the data source could be ASCII or EBCDIC. As a result, -Dfile.encoding has no effect with z/OS inputStreamReader.
If -Dibm.ascii.encoding and -Dibm.ebcdic.encoding are not set by the user then ASCII encoding will be set to ISO-8859-1 by default and the EBCDIC encoding will be set to system encoding.
Resolving The Problem
To resolve the problem, set
-Dibm.ascii.encoding=<XXXX>
-Dibm.ebcdic.encoding=<XXXX>
where XXXX is the required encoding.
For example,
If your input file is in ASCII and if you want to read with encoding ISO-8859-7, then you have to set -Dibm.ascii.encoding=ISO-8859-7.
Similarly if your input file is in EBCDIC and you want to read with encoding IBM-939, then you have to set -Dibm.ebcdic.encoding=IBM-939.
Also, if you want to provide both ASCII and EBCDIC files as input, then you can set both the properties at the same time with the required encoding.
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21506614