Topic
6 replies Latest Post - ‏2013-06-03T15:19:38Z by 3A6E_Tom_Russell
3A6E_Tom_Russell
3A6E_Tom_Russell
9 Posts
ACCEPTED ANSWER

Pinned topic EBCDIC HTML pages in WAS 8.5 Liberty

‏2013-05-17T15:41:18Z |

I am migrating a servlet from the WAS 3.5 plugin to the HTTP server on z/OS 1.8 to WAS 8.5 Liberty Profile on z/OS 1.13.  I admit I am new to WAS, but I have a lot of experience with z/OS.

This servlet does a lot of its work by creating html on disk and then sending a small page to the client which contains a frameset with multiple frames that use SRC= to point at the html files it created.  I have most of this working now. 

However, I found that on one code path, the servlet sends a file name to the host, and the host puts the html into the file.  When this html file is rendered by the SRC= in the frameset page, it shows as garbage. The page that the host created is in EBCDIC.  All other pages generated by the servlet are in ASCII. 

The production application (WAS 3.5 plugin) renders the page correctly.

I have tested by editing the html file to change the first line to include a <meta http-equiv="content-type" content='text/html; charset=IBM-1047"> but it still displays as garbage.

Is there some option in Liberty that tells it to translate pages?  

Any suggestions would be appreciated.

regards, Tom

 

  • bergmark
    bergmark
    42 Posts
    ACCEPTED ANSWER

    Re: EBCDIC HTML pages in WAS 8.5 Liberty

    ‏2013-05-21T20:17:52Z  in response to 3A6E_Tom_Russell

    Assuming I am correctly understanding the problem, you likely have at least a couple different options:

    1) Explicitly specify the file encoding of the html file you are writing to the file system.  For example if you are using a PrintWriter you can pass the desired encoding as part of the constructor.

    2) Set -Dfile.encoding=desiredEncoding value in jvm.options file to change the default file.encoding for the Liberty jvm.

  • 3A6E_Tom_Russell
    3A6E_Tom_Russell
    9 Posts
    ACCEPTED ANSWER

    Re: EBCDIC HTML pages in WAS 8.5 Liberty

    ‏2013-05-21T21:18:19Z  in response to 3A6E_Tom_Russell

    Interesting.  Thank you.  The html file is written by an Assembler program. So there is no constructor.  Does the Java constructor logic just cause the file to be written in ASCII, or does it somehow tag the file as EBCDIC?  I don't know of any "tags" that get carried forward, but perhaps as it is a z/OS HFS file, there may be a way to set an extended attribute describing the character set.  I will look into this, but if I have to change the assembler program that creates the file to somehow add an extended attribute, then I will probably just change the program to translate the data to ASCII before writing the file data. 

    Your second option is interesting as well.  The servlet creates and reads several files which are all in ASCII.  Some of these are just Logs of various things, but some are html files.  The typical interaction with the user is to create two html files on disk, and then send a page to the client which has a frameset including two frames. Each of the frames has a SRC=the htm file just created.  

    Can I change the jvm options for a specific file, or would  specifying -Dfile.encoding=IBM-1047 apply to all files? 

    I appreciate your comments. 

    Thanks, Tom

    • bergmark
      bergmark
      42 Posts
      ACCEPTED ANSWER

      Re: EBCDIC HTML pages in WAS 8.5 Liberty

      ‏2013-05-21T22:18:01Z  in response to 3A6E_Tom_Russell

      I think I was confused about your problem.  I thought you were generating an EBCDIC file, but wanted to generate the file in another codepage (like ASCII).  Changing file.encoding would change the default for the entire JVM (and all files it written using the default encoding).

      I'm not sure why serving a EBCDIC file on WAS 3.5 plugin results in a page that is able to be rendered by the browser, but on Liberty 8.5 that same EBCDIC file isn't.  I would guessed that browsers were not capable of displaying EBCDIC encoded text.  Perhaps there was some translation of the page that was occurring?

      • 3A6E_Tom_Russell
        3A6E_Tom_Russell
        9 Posts
        ACCEPTED ANSWER

        Re: EBCDIC HTML pages in WAS 8.5 Liberty

        ‏2013-05-26T22:34:05Z  in response to bergmark

        Well this has been very interesting, and I *really* appreciate your comments.   I must admit I am new to WAS, but quite experienced in *old* applications. 42 years at IBM does that.

        I changed the assembler application to translate into ASCIII and I got the page rendered correctly.  However, I carefully went through all the various control files for the production application.  The page was rendered properly in EBCDIC because *all* the pages were in EBCDIC.  Although I could not find a jvm.options file anywhere, there was an /etc/httpd.envars line that set LC_ALL=en_US_IBM-1047. I am interpreting that as setting all Locale things to EBCDIC. All of the pages for the application are indeed in EBCDIC.

        Because I was new to WAS, I followed the Quick Start guide at http://www-03.ibm.com/support/techdocs/atsmastr.nsf/WebIndex/WP102110  From this, correctly or incorrectly, I assumed that I had to create a .war file to deploy the application.  When I FTPed the html files to Windows, and imported them into Eclipse, then they were of course ASCII. So when I deployed the .war file all the pages were ASCII except for the strange file from the  assembler application. 

        OK. So I think that I have to set up the new WAS 8.5 application with EBCDIC pages. I can, as you  suggested, set -Dfile.encoding to ebcdic. (I must check the exact syntax).  I already use an "expanded WAR"  file to deploy this application.  Can I import EBCDIC pages into eclipse?  Or should I just use eclipse to compile the Java and then manually add the html files t the expanded WAR? 

        As before, any suggestions would be appreciated.

        Thanks, Tom

         

         

         

  • 3A6E_Tom_Russell
    3A6E_Tom_Russell
    9 Posts
    ACCEPTED ANSWER

    Re: EBCDIC HTML pages in WAS 8.5 Liberty

    ‏2013-05-21T21:24:12Z  in response to 3A6E_Tom_Russell

    I should mention again that I still don't understand precisely why the production service, which is the WAS 3.5 plugin to the HTTP server on z/OS 1.8, renders this page correctly.  I am testing on WAS 8.5 Liberty on z/OS 1.13, and the page displays as garbage.

    Any comments would be appreciated.

    Tom

        

    • 3A6E_Tom_Russell
      3A6E_Tom_Russell
      9 Posts
      ACCEPTED ANSWER

      Re: EBCDIC HTML pages in WAS 8.5 Liberty

      ‏2013-06-03T15:19:38Z  in response to 3A6E_Tom_Russell

      I discovered that the original HTTP server with the WAS 3.5 plugin did everything in EBCDIC because it had specified 1047 in a locale environment variable in httpd.conf.

      I also found out the eclipse lets you change the encoding for html pages and JS files, but only to ASCII code pages.  So this application is now in ASCII and the host application that created a page now creates it in ASCII as well.

      Thanks for the help.  I do appreciate your comments. 

      regards, Tom