Bad characters in debug file after upgrading from 1.38 to 1.45

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
axelar
Posts: 7
Joined: Fri Aug 19, 2022 7:30 am

Bad characters in debug file after upgrading from 1.38 to 1.45

Post by axelar »

Hey!

I did an upgrade from 1.38 to 1.45 and started having issues with the debug files. Looks like there are bad characters in the files that are preventing me from serving the content of the files through a CGI program. This is usually an issue with CCSID, but since nothing has changed in my code it's difficult for me to see what is causing this.

Here is the code that is making the request and creating the debug file:

Code: Select all

  HTTP_XmlStripCRLF(*ON);
  HTTP_setCCSIDs(1208:278 :1208:278 );  // CCSID 1208 = UTF-8
  HTTP_setOption('network-ccsid':'1208');
  HTTP_setOption('local-ccsid':'278');
  HTTP_setOption('file-ccsid':'1208');
  HTTP_setOption('content-type':''); 
http_debug(*ON:pathToDebugFile); 

  rc = http_req(
        %trim(xb.HTTPVERB)
      : build_url(messageType.HTTP_URL:xb)
      : tmpFileResponse                      // File to receive
      : *omit                 // String to receive
      : tmpFileOut                 // File to send
      : *omit      );              // String to send 

Here is the "bad character" that recently started appearing:
bad characters.png
bad characters.png (22.16 KiB) Viewed 5214 times
Any clue what might be causing this? Thanks in advance.
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: Bad characters in debug file after upgrading from 1.38 to 1.45

Post by Scott Klement »

There's a CCSID issue, but it's not in your code, it's in HTTPAPI. HTTPAPI was written in CCSID 37 -- and I'm guessing you are using CCSID 278 where the # symbol has a different value. It shouldn't hurt anything, the debugging messages will just look a little bit odd.

I don't understand what this has to do with a CGI program.

To fix it, you should convert the sources into CCSID 278 before compiling. (Or use find/replace to fix the few characters that are different.)

I suspect (but haven't tried it) that if you install using the .ZIP installer, the problem would be fixed automatically because it uploads the the source from your PC in ASCII mode, so it would get automatically translated to the correct CCSID.
axelar
Posts: 7
Joined: Fri Aug 19, 2022 7:30 am

Re: Bad characters in debug file after upgrading from 1.38 to 1.45

Post by axelar »

The CGI program stopped working, that's just how I realized that something was going on with the debug files.

I renamed all the source files, created new source files with CCSID 278 and copied all the members from the renamed source files to the new.

Then I recompiled the install program and ran it.

It is now working as expected.

Thank you for providing the community with a great library, and for helping me out so quickly!
Post Reply