Hi,

I have been trying to get Cactus (1.4.1) to work under WebSphere z/OS.
It hasn't been too straight forward because z/OS is a mainframe
operating system and as such developers in general often don't consider
its platform differences, mainly the underlying EBCDIC character set. 

The particular problem that I am getting with Cactus is in the getText
method in the IoUtil class. The use of the InputStreamReader is causing
the characters read to be encoded using the default system encoding,
this is an EBCDIC codepage Cp1047 that is being used in my case.
However, the underlying data in the InputStream is not in EBCDIC! but
ascii so the conversion is causing problems.

I have changed some code to get Cactus to work under z/OS. I hope these
changes can be accepted into the builds because it is a very useful tool
which would provide a great deal of benifit to the mainframe community.

Are there any objections to the following code replacement in the
gettext method of IoUtil.java

public static String getText(InputStream theStream)
    throws IOException
{
   StringBuffer sb = new StringBuffer();
            
   BufferedInputStream input = new BufferedInputStream(theStream);
   byte[] buffer = new byte[2048];
   int nb;
   while (-1 != (nb = input.read(buffer, 0, 2048))) {
      sb.append(new String(buffer, 0, nb, "US-ASCII"));
   }

   input.close();

   return sb.toString();

}


I have hardcoded US-ASCII, but this could be externalized somehow and
even maybe provide the user with the ability to specify the encoding. 

I have not found any other areas that need to be changed for z/OS,
although there where many with HttpClient but these have been sorted out
now with the latest release.


Best Regards
Neal Johnston-Ward   



Reply via email to