Hi Steve,

Sort of.

QtwmWrStout() never converts anything -- it passes the data as-is from your program to Apache. However, when Apache forwards the data onward across the network with the HTTP client (i.e. web browser) it might or might not convert it.

The CgiConvMode setting controls when it does/doesn't convert it.

Normally, data is only converted if the content-type is text-based. So a content-type of text/html, text/xml, text/plain, etc... any text-based type is converted. However, non-text types such as application/vnd.ms-excel (which is Excel's original binary file format... .XLS) are not converted.

If your data is XML, then you'll either want to pre-convert it (use iconv to convert it to UTF-8) or specify a content-type of text/xml. (Using text/xml might not be optimal, because the browser probably won't want to send it to Excel.)

Good luck!


On 9/10/2012 8:12 AM, Steve Richter wrote:
Does the QtmhWrStout api convert the data passed to it from ebcdic to ascii?

I ask because I am trying to send excel xml formatted data as an
attachment to the browser and the results are gibberish when opened in
excel.

I am sending different variations of Content-type and
Content-disposition followed by two X'15' line feeds.
wrtDta = 'Content-type: application/vnd.ms-excel' +
newLine +
'Content-disposition: ' +
'attachment; filename=test.xls' + newLine +
newLine ;
pr_qtmhwrstout( wrtdta: %len(wrtdta): wperror ) ;

another version of the content-type I tried:
wrtDta = 'Content-type: application/' +
'vnd.openxmlformats-officedocument.spreadsheetml.sheet' +
newLine +
'Content-disposition: ' +
'attachment; filename=test.xls' + newLine +
newLine ;

then I send the excel xml formatted data: Where each line ends with
x'15' . So far I have written the following text to qtmhwrstout as
ebcdic and then as ascii. Both times excel shows garbage.

<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40";>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="2"
x:FullColumns="1" x:FullRows="1">
<Row>
<Cell><Data ss:Type="String">Name</Data></Cell>
<Cell><Data ss:Type="String">Example</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Value</Data></Cell>
<Cell><Data ss:Type="Number">123</Data></Cell>
</Row>
</Table>
</Worksheet>
</Workbook>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.