[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ftpapi] Best Practice When the Content Type of a Response Is Unknown



Hi all,

looking for a /best practice/ I hope someone can help me with her or
his experience:

I have to send a request to a service that answers either with a PDF
file (Content-Type: application/pdf) or with an XML file (Content-Type:
text/xml;charset=ISO-8859-1).

When I receive an XML file, http_req() works fine and correctly translates
ISO-8859-1 to EBCDIC. With PDF, it works likewise -- but translating binary
data from ISO-8859-1 to EBCDIC is not the best idea.

What I’ve already learned: A program can tell HTTPAPI which conversion
tables to use by calling HTTP_setCCSIDs() or
http_setOption('LOCAL-CCSID':0)

But as far as I understand, this is not to do a conversion /after/ the
response has been received.

In the past, I re-converted PDF data to ISO-8859-1 using iconv() when I
had received data from the GSKit API -- yes, it worked, but I think
there must be a better, more reliable solution with HTTPAPI.

So, what should I do if I don’t know the content type of the response at the time I am sending the request?

Thanks for any suggestions,
Markus
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi