Issue with hyphen minus Vs minus sign with xml payload

We are facing issue with hyphen minus vs minus symbol within apigee. Did anyone face such issues?How can resolve it? Its the partner who initiates the data & with in apigee it fails.

Once we replaced with the minus symbol it process.

ref:

https://unicodelookup.com/#minus/1

eg:

<Element ChangeType="Nochange" OldValue="-77.12186" PCMElementXPATHText="//abc/def/ghi[1]/jkl">-77.12186</Element>

It throws below error.

error.content = {"Envelope":{"Body":{"Fault":{"Code":{"Value":"env:Receiver","Subcode":{"Value":"messaging.adaptors.http.UnexpectedEOF"}},"Reason":{"Text":{"lang":"en","":"Unexpected EOF"}}}}}}
Solved Solved
1 1 1,569
1 ACCEPTED SOLUTION

Hi -

I'm not clear on the problem, but I think you are saying that the XML document in question includes a unicode 0x2212 character (hyphen), which Apigee chokes on. and when you replace it with a n ASCII 0x2D character (minus), then Apigee Edge accepts the document.

Is that right?

You didn't show the doc header nor the content-type header used in passing this document to Apigee Edge. Apigee Edge will take the hint from the Content-type header I believe. If that header says the doc is utf-8, then it is ok to use the 0x2212 character. If not, then not. Eg, if your inbound request header is like this:

Content-Type: text/xml; charset=utf-8

...then Apigee Edge will happily parse the XML document that contains unicode.

On the other hand if the Header does not specify UTF-8 and if you pass in a document that DOES include UTF-8, then Apigee Edge will (rightly, in my opinion) reject that document as invalid.

So can you please verify for me that your content-type header agrees with the content included in the document? If using 0x2D, then no utf-8 is required. If using 0x2212, then you must pass in a header that includes 'charset=utf-8'.

Also double check that the XML declaration itself does not claim to be ASCII. It should also claim UTF-8, or should not be present. (Actually I'm not sure about the latter - no decl line at all - but I think it ought to work.)

example declaration line:

<?xml version="1.0" encoding="UTF-8"?>

In summary, Your partner is serializing the XML document in some way, and producing UTF-8, and the partner needs to form the API request in the right way, with the right http header and the right XML Decl, in order to send that utf-8 data .

View solution in original post

1 REPLY 1

Hi -

I'm not clear on the problem, but I think you are saying that the XML document in question includes a unicode 0x2212 character (hyphen), which Apigee chokes on. and when you replace it with a n ASCII 0x2D character (minus), then Apigee Edge accepts the document.

Is that right?

You didn't show the doc header nor the content-type header used in passing this document to Apigee Edge. Apigee Edge will take the hint from the Content-type header I believe. If that header says the doc is utf-8, then it is ok to use the 0x2212 character. If not, then not. Eg, if your inbound request header is like this:

Content-Type: text/xml; charset=utf-8

...then Apigee Edge will happily parse the XML document that contains unicode.

On the other hand if the Header does not specify UTF-8 and if you pass in a document that DOES include UTF-8, then Apigee Edge will (rightly, in my opinion) reject that document as invalid.

So can you please verify for me that your content-type header agrees with the content included in the document? If using 0x2D, then no utf-8 is required. If using 0x2212, then you must pass in a header that includes 'charset=utf-8'.

Also double check that the XML declaration itself does not claim to be ASCII. It should also claim UTF-8, or should not be present. (Actually I'm not sure about the latter - no decl line at all - but I think it ought to work.)

example declaration line:

<?xml version="1.0" encoding="UTF-8"?>

In summary, Your partner is serializing the XML document in some way, and producing UTF-8, and the partner needs to form the API request in the right way, with the right http header and the right XML Decl, in order to send that utf-8 data .