cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the xml encoding from UTF-8 to ISO-8859-1

Former Member
0 Kudos

Hi,

I have created an xml file in xMII transaction that I feed into a webservice as input. As of now, the data in the xml file is entirely english text (it would be changing to have European text soon). I gave the encoding as UTF-8.

I get an error on the webservice side(not xMII code) that the its not able to parse. The error is 'SaxParseException: Invalid 1 of 1-byte UTF-8 sequence). I know that an easy fix is if tI change the encoding to iso-8859-1.

But the reference document doesnot let me put anythign other than UTF-8. Even if I put <?xml version="1.0" encoding="iso-8859-1"?> as the first line, when I save it and open it back, i see <?xml version="1.0" encoding="UTF-8"?>

Is there any way to change the encoding? Or better still, anyway idea why this invalid sequence is coming from?

Thanks,

Ravi.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

This most probably is an indication that your XML contains an invalid character.

Post the XML for the forum.

Former Member
0 Kudos

Udayan,

It looks like an encoding issue, but unfortunately I cannot send the xml that is crashing. This question is not related to xMII but are there any tools to find the encoding issues in an xml?

I am fairly sure that if we change the encoding of xml from UTF-8 to ISO-8859-1, the webservice on our end will go through. So, I have these options, either to find and correct the encoding or change the encoding. I was looking at the second option, but looks like it maynot be possible to change the default encoding. So, will now try find and correct the encoding.

Former Member
0 Kudos

Are you using the xMII web service action? If so, switch to using the xMII "Post" action, and send/receive the entire SOAP message. You have more control over encoding with the Post action.

Former Member
0 Kudos

Thanks Rick. I think using the post should solve the problem with the encoding. Will try it tomorrow.

But one problem is that I am not able to save the xml templates with any encoding other than utf-8. Then again, I can use the post xml as a text message. Hope this solves the problem but is there any way to save the xml templates in any other format in 11.5 SR3?

Ravi.

Former Member
0 Kudos

Hi Ravi,

We have encountered scenarios where we needed to take the <?xml version="1.0" encoding="UTF-8"?> out completely. As xMII was providing the Web Service, it needed a workaround.

In your case, it seems that you wish to pass it from xMII to an external Web Service provider. One option might be to pass the XML document as string.

Once you convert it to a string, it may escape all XMl characters (i.e. '<' into '&lt;'). You could perform a string manipulation and remove the <?xml version="1.0" encoding="UTF-8"?> from the string. You may also need to play around with xmlDecode( string ) function in the Link Editor.

I would suggest that before you try this option, create a string variable will the contents, but without the <?xml version="1.0" encoding="UTF-8"?> and try assigning it to the input.

You may also wish to try a string variable that has <?xml version="1.0" encoding="iso-8859-1"?> as the first line. If this works, you should be able to perform string manipulations to convert your XML document into this modified string.

Cheers,

Jai.