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

Re: Question about http_url_post_raw2()



Hi Scott
thank you for your answer. I try to explain my problem better. I have some problem reading a web service response that contains German characters, see my prevoius post. In this project I use both Httpapi and WSDL2RPG. When my program read the webservice response that contains german characters it ends abnormally saying that there was a wrong encoding character. The web service provider tells that the encoding was correct. So, according with Thomas Raddatz, I modified the program where I read the answer and using the http_url_post_raw2() I wrote the answer into a ifs file. The code snippet is:
fd2 = open('/tmp/logmm.log'
        : O_CREAT + O_TRUNC + O_WRONLY
        : S_IRWXU + S_IRWXG + S_IRWXO);
dou (not HttpResponse_isAuthenticationError(http_rc));
  // Get document from server and handle http redirects
  // See also: WSDL2R88.HttpResponse_isRedirect()
  dou (not HttpResponse_isRedirect(http_rc));
     http_DebugLog_appendText(
     '** ' + %char(%timestamp()) + ': Sending request to server');

     http_rc =
        http_url_post_raw2(
           url
           : hInpStream
           : %paddr('WSDL2R85_MessageContext_InputStream_read')
           : MessageContext_getSize(hMsgCtx)
           : fd2
           : %paddr('write')
           : getTimeout()
           : getUserAgent()
           : '');

      callp close(fd2);
      leave;
Enddo ;
What I would like to have in the 'tmp/logmm.log' file is the webservice answer as is alias in utf-8 but when I saw with Notepad++ it was in ANSI. Where is my mistake? And what is your opinion about this error for the german char that I receive from EXPAT?
Best regards
Mario

-----Messaggio originale----- From: Scott Klement
Sent: Wednesday, October 12, 2016 12:21 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Question about http_url_post_raw2()

Mario,

You are telling the open() API to create the file in EBCDIC, but you are
telling me that the data is UTF-8.  I don't understand why you are doing
that?

http_url_post_raw2() never translates data.  So if you tell the open()
data that it should use EBCDIC, but the data is UTF-8, the file will be
marked with the wrong CCSID, and that will confuse any program that
relies on the CCSID.

-SK


On 10/11/2016 5:50 AM, Mario Martoriello wrote:
    Hi all
    is possible that http_url_post_raw2()  does some traslantion for the
    received data? If I use this function and then write the incoming
    data(that should be encoding in utf-8) to a stream file, opened with
    these instruction
    fd2 = open('/tmp/logmm.log'
             : O_CREAT + O_TRUNC + O_WRONLY
             : S_IRWXU + S_IRWXG + S_IRWXO);
    how are they written in utf-8 or ansi?
    Thanks in advance
    Mario Martoriello



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------