Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

# symbol in string after base64 encoding/decoding

rauno_veberson2
Participant
0 Kudos

Hello!

We are sending XML files from our ERP to another SAP system. In order to send those files we first encode them, insert encoded text into SOAP message body and then send to a webservice that deals with forwarding the request to our target system. However there is a slight mistake in encoding the xml file - after decoding there appears to be a "#" symbol in the very beginning of the file. I've debugged the encoding process multiple times and this symbol does not exist there before encoding. This doesn't necessarily mean that there is a "#" symbol in the file. It could be newline or some other kind of symbol yet I used CONDENSE on that string and it doesn't make the problem go away. Has anybody else had this problem in the past?

I should also add that the files being read are BCM Batch payment files that are stored in TemSe.

1 ACCEPTED SOLUTION

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Try:

  REPLACE first OCCURRENCES OF REGEX '[\n\t\r]' IN <your string> WITH '' .

             

regards.      

7 REPLIES 7

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Try:

  REPLACE first OCCURRENCES OF REGEX '[\n\t\r]' IN <your string> WITH '' .

             

regards.      

0 Kudos

Already tried that. But this problem still exists.

0 Kudos

Hi,

If you write the file as plain text to some share folder do you have this problem ?

Do you see the character in debug ? if yes find out the hex code.

            

regards.

0 Kudos

I debugged the program and here I saw no symbols whatsoever. However when I wrote the string to a file I saw that symbol. Downloaded the file from ERP and checked it with Hex editor. It turned out to be BOM. That's funny though because this problem has never surfaced before.

0 Kudos

Now rises the question how to remove this byte order mark? If I would read this XML from a physical file then I could just say SKIPPING BYTE-ORDER or sth like that. However I use "FI_PAYM_FILE_READ" and this doesn't allow me to specify additional options. Should I just write the string to file and then re-read this file without BOM? Or maybe this could be achieve more elegantly?

0 Kudos

Hi,

Assuming the XML is one big string......

Try (I did not test this)

OPEN DATASET in BINARY MODE


TRANSFER dobj TO dset NO END OF LINE .


close....

regards.

0 Kudos

Well that's the thing. I shouldn't need to write this XML into physical file before it has reached its destination. And it should already be sent in correct form. So what I need to do, is remove BOM from string and then encode it.