ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

QtmhWrStOut() without character set conversion?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • QtmhWrStOut() without character set conversion?

    I have written an RPGLE CGI program to retrieve a html file from the IFS (via SQL and CLOB_FILE) and return it to the requestor (via QtmhWrStOut()). To see if I could.

    As far as I understand, because of the web server settings, QtmhWrStOut() character set converts from EBCDIC 37 to UTF-8. The HTML file is UTF-8. So I am reading the HTML IFS file into a CCSID 37 host variable to character set convert it, and passing that to QtmhWrStout(). This is effectively double converting it - UTF-8 -> EBCDIC 37 -> UTF-8

    Is there a way to use QtmhWrStOut() in a way that means it does not character set convert? So I do not need to double convert the HTML file? Or so I can return a binary file like a PDF?

  • #2
    This is controlled by settings in your httpd.conf file.

    The main setting you want to look at is CgiConvMode (there are others that control the specific CCSIDs)

    Comment


    • #3
      If I specify text/html and then pass text in CCSID 37 to QtmhWrStOut(), it displays correctly in browser so it must be converting it from 037 to UTF-8.

      If I specify application/pdf and then write the raw bytes of a PDF file on the IFS to QtmhWrStOut(), it displays correctly in browser so it must not be converting it.

      So I think, the web server is intelligent enough to apply CCSID conversion selectively based on the specified content-type?

      Comment

      Working...
      X