× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



not sure about RPG CGI, but I got this sort of data a lot when sending JSON
from PHP to Javascript. Had to do with translating from EBCDIC to ASCII.
In my case I changed the CCSID of some columns to 1208. ( which actually
might not have been necessary. ) Also had to work with the parameters in
PHP when converting to JSON.

On Fri, May 24, 2019 at 11:43 AM Justin Taylor <JUSTIN@xxxxxxxxxxxxx> wrote:

I have a CGI webservice written in RPG that returns JSON. It processes
about 200 requests a day and has been in production for a couple of weeks.
I have one request that consistently returns strange garbage at the
beginning of the response. So far, I’ve only seen a single request that
does this. I can’t see anything unusual about this request. I’ve debugged
the RPG code, and it looks to be functioning correctly.

Any suggestions on where to look now? TIA


Here is what a normal response looks like:
HTTP/1.1 200 OK
Date: Fri, 24 May 2019 15:05:38 GMT
Server: Apache
Content-Type: application/json; charset=utf-8
Content-Length: 80297

{json_data_here}



Here is what the bogus response consistently shows:
HTTP/1.1 200 OK
Date: Fri, 24 May 2019 15:27:05 GMT
Server: Apache
Content-Type: image/x-portable-graymap
Content-Length: 91261


�`鉗@�K��@@Ö�������@M�]@����`����@ɇ��@ׁ����@@����`��`��%�����@兙����@�K��@M������~��m��k䣆��~��kȤ��Ɖ���~��k�@���]%%י��������@�������z@a
���a���`������������`����`�����m������m��������������������K���%%ŧ��������@@�����K���%ŧ��������@@�����K���%ŧ��������@@����K���%ŧ��������@@������K���%ŧ��������@@�ä���K���%%ť��������@��@֒%%Ɖ���z@
�%≩�z@@@@@@@�����%Ö��������z@����%⣁���z@���@��
%�����`����z@�����������a����^@�������~���`�
%
%{json_data_here}



RPG snippet:
yajl_genOpen(*off);
yajl_beginObj();
yajl_addChar('' : );
yajl_addCharPtr('' : :);

yajl_endObj();

yajl_copyBuf( 1208
: %addr(lJsonData)
: %size(lJsonData)
: lLength );

yajl_genClose();

lDataOut = 'Status: 200 OK'
+ CRLF
+ 'Content-type: application/json; charset=utf-8'
+ CRLF + CRLF
+ lJsonData
+ CRLF
;
lLength = %len(%trimr(lDataOut));

QtmhWrStoutAPI(lDataOut :lLength :QUSEC);
If QUSEI = *blank;
Else;
Endif;
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.