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 17, 2017 2:22 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

    Thanks, Sergey, the chtag command was unknown to me.
    So I tagged the input JSON file as EBCDIC, but I still get the error message “unexpected character”, because the data are required to be in ASCII (HTTP annd REST) and no conversion is done internally (at least my interpretation). I also tried the autoconvert options Matt supposed, The only effect was that the trace file returned is EBCDIC.
    Sorry to bother you, but I’m not very skilled with UNIX.
    Thanks,
    Werner

    Sergey Rezepin
    Rocketeer
    May 22, 2017 8:55 AM UTC

    Thanks, Sergey, the chtag command was unknown to me.
    So I tagged the input JSON file as EBCDIC, but I still get the error message “unexpected character”, because the data are required to be in ASCII (HTTP annd REST) and no conversion is done internally (at least my interpretation). I also tried the autoconvert options Matt supposed, The only effect was that the trace file returned is EBCDIC.
    Sorry to bother you, but I’m not very skilled with UNIX.
    Thanks,
    Werner

    Hi Werner,

    The following values specified for environment variables for the latest versions of bash in README.ZOS:

    export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
    export _BPXK_AUTOCVT=ON
    export _TAG_REDIR_ERR=txt
    export _TAG_REDIR_IN=txt
    export _TAG_REDIR_OUT=txt
    

    But they are used not only for bash. Probably, we need to add this information to README.ZOS for cURL too.
    In that case, all new files create in ASCII encoding and tag as ISO8859-1 by cURL.
    The existent files read according to their tags.

    Could you please to write some examples of commands you are using for work with JSON and REST, especially what key/options are using for work with the files?

    Thanks,
    Sergey

    Jun 7, 2017 1:51 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

    Hi Sergey,
    I’d like to send you data about my tests, content of JSON file, REST commands, comparison of test results with cURL 7.42.1 and 7.52.1, because they behave differently. However, this is too much for this forum. Is there a way to send this to you directly (if you are interested, of course)?
    Thanks,
    Werner

    Tatiana Balaburkina
    Rocketeer
    Jun 7, 2017 3:57 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

    Hi Werner,

    it is possible to attach a file(s) to your reply here. The 7th button on replying form is “Upload”. Could you try this way?

    Thanks,
    Tatyana

    Jun 8, 2017 9:48 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

    Ok, here’s the first cURL_test_results.doc (28.5 KB)

    Jun 8, 2017 9:49 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

    And the second… cURL cmd_JSONfile.doc (22.5 KB)

    Sergey Rezepin
    Rocketeer
    Jun 9, 2017 8:43 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

    Hi Werner,

    Now, cURL is supporting only IBM-1047 and ISO8859-1 encodings for existent tagged files.
    And all new files created by cURL is being saved as ASCII and tagged as ISO8859-1 (the trace files are included).

    In next build, there is a planning to add the following environment variables:
    _ENCODE_FILE_NEW - to set encoding and tag for the new files.
    It’s allow to choose output encoding for files.
    _ENCODE_FILE_EXISTING - to control reading/writing untagged files properly.
    They could be set to the following values: ISO8859-1, IBM-1047, UNTAGGED, BINARY.

    Unfortunately, if you have files in another encoding (for example, IBM-1141) you need to convert them to ISO8859-1 or IBM-1047 and tag them in according with their encoding before using by cURL.
    iconv -f IBM-1141 -t IBM-1047 file1 > file2
    chtag -tc IBM-1047 file2
    or
    iconv -f IBM-1141 -t ISO8859-1 file1 > file2
    chtag -tc ISO8859-1 file2
    I’m studying your case and will discuss with team is there a possibility to use another EBCDIC code pages.

    Thanks,
    Sergey

    Jul 5, 2017 10:46 AM UTC

    And the second… cURL cmd_JSONfile.doc (22.5 KB)

    Please note there will be a delay in delivering a new build that supports new environment variables previously mentioned. The engineering team has been diverted to a more urgent task.
    Regards,
    -Peter