Ask a Question

SOH and STX charcters are being replaced with quetion mark(?) in the soapui XML file.

ravi_ava
Occasional Contributor

SOH and STX charcters are being replaced with quetion mark(?) in the soapui XML file.

We have been trying to create a project in soapui to invoke a rest api service. The rest API service POST method accept text with special charcters(SOH and STX) as request. When we are trying to save the project with .xml file, SOH and STX charcters are being replaced with question mark(?) in xml file.

Below configuration is used in soapui tool.

Service : REST API

Method: POST

Content-type: text/plain

Charset : utf-8

 

15 REPLIES 15
ravi_ava
Occasional Contributor

I have changed encoding as UTF-8 in system propertiesm(attached screen shot) but still replacing with question mark.

ravi_ava
Occasional Contributor

Hi, Ok, I will try with the options and will update you on the same.

Hi,

Swapping between utf-16 and utf-8 wont make any difference for your issue.
You need to encode your characters correctly!

 

As I said before (I obviously wasn't clear) escape sequences exist for the control characters you care about (if there wasn't, you wouldn't be able to do anything except delete the chars from your payload):

 

for the SOH character sequence, replace 'SOH' with '' 

for the STX character sequence, replace 'STX' with ''

 

I've just done this on my machine and I've just executed it fine - the characters are saved as the escape sequences in the XML (see pic)

HelloWorld.PNG

 

and the content of my script is

 

HWScriptContent.PNG

 

So no issues!

 

As I said before - whether it was UTF-8 or UTF-16 wouldn't make any difference  in this case - UTF-16 is a superset of UTF-8 - i.e. every character in UTF-8 exists in UTF-16.  Also - all the characters in UTF-8 have the same escape sequences as the equivalent character in UTF-16. 

 

Hope this has explained a little and helped!

Rich

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
ravi_ava
Occasional Contributor

Hello,

 

If we add control charcters (&#x2) in our .xml file while importing to the soapui and testing we are getting an error response as our request is not accepting these chars.

Hi @ravi_ava,

Can you confirm what your requirements state the allowed charset on your submissions is? Those escape sequences work for and endpoint expecting utf-8.

I'll have another look at the other equivalent escapr sequences for these control characters and get back to you with a subsequent post.

Cheers

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
richie
Community Hero

Hi @ravi_ava 

 

did you check the requirements of the allowed charset on your requests - just to confirm?  We need to know absolutely what the supported charset that your endpoint is expecting - otherwise you'll never sort this.  Its a quick fix once we know - but we need this info fella

 

For  your submissions to your endpoint - do you get a payload for a successful submission?  if so - can you confirm what the Content-Type header in the response is please?

 

I'm guessing application/json - but things can get complicated of it's odata json etc.(e.g. application/json; odata.metadata=minimal;)

 

cheers,

 

rich

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: