Skip to main content
May 2, 2017 7:46 AM UTC

cURL returns EBCDIC response

I’m calling REST API services with cURL and get a JSON payload back. Using cURL 7.16.1 the response is in ASCII, however using cURL Version: 7.42.1 Build Number: 0013 the response comes back in EBCDIC. Additionally to the EBCDIC output there is error message curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding.This all could be seen in the trace files.
As we run all that in z/OS 2.2 I would prefer the EBCDIC response, but how to react to the error message?
Any help is appreciated.
Thanks, Werner

    18 replies

    May 2, 2017 7:50 AM UTC

    I’m calling REST API services with cURL and get a JSON payload back. Using cURL 7.16.1 the response is in ASCII, however using cURL Version: 7.42.1 Build Number: 0013 the response comes back in EBCDIC. Additionally to the EBCDIC output there is error message curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding.This all could be seen in the trace files.
    As we run all that in z/OS 2.2 I would prefer the EBCDIC response, but how to react to the error message?
    Any help is appreciated.
    Thanks, Werner

    by the way, I tried the --use-ascii option mentioned in another thread to no avail.
    Werner

    May 3, 2017 4:05 PM UTC

    by the way, I tried the --use-ascii option mentioned in another thread to no avail.
    Werner

    We are also using the 7.42.1 build of curl and are experiencing a similar issue with JSON REST results. About half the time the results are returned in EBCDIC, and the other half it comes back in ASCII. We’ve controlled for this by running the output through the iconv utility when it comes back in ASCII.

    We are having an issue in certain cases where the codepage switches in the middle of the output, and half the string is in ASCII, half in EBCDIC. If anyone from rocket is monitoring this post - is there any explanation for why this would occur?

    –use-ascii had no effect for us as well

    May 4, 2017 2:24 AM UTC

    I’m calling REST API services with cURL and get a JSON payload back. Using cURL 7.16.1 the response is in ASCII, however using cURL Version: 7.42.1 Build Number: 0013 the response comes back in EBCDIC. Additionally to the EBCDIC output there is error message curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding.This all could be seen in the trace files.
    As we run all that in z/OS 2.2 I would prefer the EBCDIC response, but how to react to the error message?
    Any help is appreciated.
    Thanks, Werner

    Thanks Matt for sharing your experience. Oh no, your case is much worse than ours, if the coding changes within a string …
    Anyway, good to know I’m not alone :slight_smile:

    May 5, 2017 1:14 PM UTC

    Thanks Matt for sharing your experience. Oh no, your case is much worse than ours, if the coding changes within a string …
    Anyway, good to know I’m not alone :slight_smile:

    To clarify, we are also on build 13. I tried re-extracting the package over again, in case I had missed anything and still had the same results. For now, a retry on the failure message is a simpler coding challenge than trying to handle mixed output, but if this is something that can be addressed with a new build, I’d be happy to provide samples if it will help.

    Sergey Rezepin
    Rocketeer
    May 12, 2017 3:34 AM UTC

    I’m calling REST API services with cURL and get a JSON payload back. Using cURL 7.16.1 the response is in ASCII, however using cURL Version: 7.42.1 Build Number: 0013 the response comes back in EBCDIC. Additionally to the EBCDIC output there is error message curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding.This all could be seen in the trace files.
    As we run all that in z/OS 2.2 I would prefer the EBCDIC response, but how to react to the error message?
    Any help is appreciated.
    Thanks, Werner

    cURL 7.52.1 was released.


    Could you please to try the build of this version?
    If you will have the problems too, please let us know.

    Thanks,
    Sergey

    May 12, 2017 12:25 PM UTC

    cURL 7.52.1 was released.


    Could you please to try the build of this version?
    If you will have the problems too, please let us know.

    Thanks,
    Sergey

    Sergey,

    Thanks, I did see that announcement, and I have begun testing with the new version and it does consistently return an ASCII response, at least so far. With autoconvert, I do see it translated correctly to EBCDIC when I execute the query.

    I do have a related problem, but moreso with Enchanced ASCII in general, in that when cURL is executed from within a Perl script, autoconversion does not occur even though the environment variables appear to be set up correctly.

    Thanks,
    Matt

    May 16, 2017 3:11 AM UTC

    cURL 7.52.1 was released.


    Could you please to try the build of this version?
    If you will have the problems too, please let us know.

    Thanks,
    Sergey

    Sergey.
    thanks a lot for the new build. Using it shows some changes:

    • the cURL trace file is now ASCII (7.42.1 was EBCDIC)
    • the cURL response is now ASCII (7.42.1 was EBCDIC)
    • the JSON input file for the REST services have to be in ASCII now. As I call cURL from REXX (z/OS) the JSON file is created in EBCDIC. Now I have to convert it to ASCII before calling cURL. This is different to build 7.42.1, where the input file could be EBCDIC. Any chance/parm to change that?
    • the error message (56) Illegal or missing hexadecimal sequence in chunked-encoding disappeared. It ends now without any error messages.

    What you mean by “be sure your files are tagged”???
    Thanks,
    Werner

    May 16, 2017 3:29 AM UTC

    Sergey,

    Thanks, I did see that announcement, and I have begun testing with the new version and it does consistently return an ASCII response, at least so far. With autoconvert, I do see it translated correctly to EBCDIC when I execute the query.

    I do have a related problem, but moreso with Enchanced ASCII in general, in that when cURL is executed from within a Perl script, autoconversion does not occur even though the environment variables appear to be set up correctly.

    Thanks,
    Matt

    Matt,
    where do you specify autoconvert to get EBCDIC?

    Thanks,
    Werner

    Sergey Rezepin
    Rocketeer
    May 16, 2017 6:41 AM UTC

    Sergey.
    thanks a lot for the new build. Using it shows some changes:

    • the cURL trace file is now ASCII (7.42.1 was EBCDIC)
    • the cURL response is now ASCII (7.42.1 was EBCDIC)
    • the JSON input file for the REST services have to be in ASCII now. As I call cURL from REXX (z/OS) the JSON file is created in EBCDIC. Now I have to convert it to ASCII before calling cURL. This is different to build 7.42.1, where the input file could be EBCDIC. Any chance/parm to change that?
    • the error message (56) Illegal or missing hexadecimal sequence in chunked-encoding disappeared. It ends now without any error messages.

    What you mean by “be sure your files are tagged”???
    Thanks,
    Werner

    Werner,

    What you mean by “be sure your files are tagged”???

    To see the current tags:

    ls -T

    To tag EBCDIC file:

    chtag -tc 1047 file

    To tag ASCII file:

    chtag -tc 819 file

    It may be helpful to avoid the behaviour when untagged files reads as ASCII.

    It’s recommended to tag files according to their encoding.
    And, in that case, cURL must be working correctly with the input tagged files independent of their encoding.

    All new files created by cURL have ASCII encoding and tagged as ASCII - it’s normal behaviour.

    Thanks,
    Sergey

    May 16, 2017 9:14 AM UTC

    Werner,

    What you mean by “be sure your files are tagged”???

    To see the current tags:

    ls -T

    To tag EBCDIC file:

    chtag -tc 1047 file

    To tag ASCII file:

    chtag -tc 819 file

    It may be helpful to avoid the behaviour when untagged files reads as ASCII.

    It’s recommended to tag files according to their encoding.
    And, in that case, cURL must be working correctly with the input tagged files independent of their encoding.

    All new files created by cURL have ASCII encoding and tagged as ASCII - it’s normal behaviour.

    Thanks,
    Sergey

    Werner,

    To set autoconvert on, there are a few USS environment variables to set. See the following post regarding unzip with Enhanced ASCII:

    And:
    https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.ceea300/filtag.htm

    Regards,
    Matt