ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RobinFernandes <>
Subject Re: Ant on z/OS
Date Wed, 01 Apr 2009 18:34:14 GMT

Sorry to revive an old thread. I'm seeing the same problem as described
below: <property environment="env" /> is failing on z/OS when specifying a
non-EBCDIC encoding in -Dfile.encoding. Verbose output is:
 [property] Loading Environment env.
 [property] Ignoring:
 [property] <lots of garbage characters here...>

I'm using Ant 1.7.1 on IBM JDK 6 (IBM z/OS build pmz3160sr3-20081108_01

I think I've tracked the issue down to this code in
org/apache/tools/ant/taskdefs/, which forces the raw output of
the env var command to be treated as Cp1047 bytes, regardless of
-Dfile.encoding (this code is present in 1.7.1 and trunk):
    public static String toString(ByteArrayOutputStream bos) {
        if (Os.isFamily("z/os")) {
            try {
                return bos.toString("Cp1047");
            } catch ( e) {
                //noop default encoding used

If I remove this behaviour and simply return bos.toString(), <property
environment="env" /> loads correctly irrespective of whether -Dfile.encoding
is set to a non-ebcdic encoding.

Just a guess: perhaps that code was a work-around for older JDKs where
file.encoding didn't affect env, and should now be removed? 


Anuradha Weeraman wrote:
> Hi All,
> I'm having what appears to be some character set related issues when
> running Ant on z/OS under USS. I have tracked down the issue to the
> <property environment> tag which doesn't seem to be able to pick up
> environment variables and spews ASCII text when the following
> IBM_JAVA_OPTIONS variable is defined:
> -Dfile.encoding=ISO8859-1 -Dconsole.encoding=IBM-1047 -Xnoargsconversion
> The ASCII text, when converted to EBCDIC appears to be environment
> variables, so I'm guessing that Ant internally expects the environment
> variables in EBCDIC (possibly from the output of /bin/env) which
> somehow gets converted to ISO8859-1 due to the file.encoding
> parameter, leading to its confusion.
> Ant 1.5.3-1 is bundled with the version of Maven that I use, and it
> requires the IBM_JAVA_OPTIONS to be set.
> Has anyone experienced this before? Does anyone know if Ant is capable
> of handling custom file.encoding as in this case?
> Regards,
> Anuradha

View this message in context:
Sent from the Ant - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message