Bad request -API -UIPATH

Hi all, this is the description value extracted but it has this funny red word, not sure what it is but I cannot send a request because it gives an error: seems like the API is rejecting it…
How can I escape this with UiPath,this description has a variable, I am developing with UiPath studio?

image

Hi @Anelisa_Bolosha1 ,
How did you passed the value & from where you are extracting the value. can you share the screenshot.
its seems like syntax error or while you are extracting unexpected char was present

Regards,
Arivu

Hi @Anelisa_Bolosha1,

What you’re seeing is most likely not a UiPath issue but a hidden/invalid Unicode character in the extracted text (often a non-breaking space, zero-width character, or control symbol). These characters render as small red blocks in editors and can cause APIs to reject the payload even though the text looks normal.

A reliable fix is to sanitize the string before sending it. In UiPath Studio, you can remove problematic characters using a Replace or Regex step, for example removing control characters:

System.Text.RegularExpressions.Regex.Replace(description, "[\p{C}]", "")

If needed, also normalize encoding (UTF-8) before the API call.

Once the hidden characters are stripped, the request should go through normally.

1 Like

@Ghaith_abdesselem thank you, how would I encode UTF-8 char in UiPath?

@Anelisa_Bolosha1

Can you give a try with below expression in assign activity

strDescription = Newtonsoft.Json.JsonConvert.ToString(yourvalue)

Hi @yedukondaluaregala ,thank you for this?
Will this be to encode?

1 Like

This solved it, I appreciate it

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.