Removing Unicode characters

Good day all, I have the bellow data that I am trying to pass on the API field:

It keeps on failing because it has some Unicode characters (\u0007), so the API keeps on failing because of that. Anyone who can please help on removing these using regex maybe not just this one but any unicode characters which might likely also appear in the future and not only this one.

Error :

Hi,

If you want to remove \u0000 style string, the following expression may help you.

System.Text.RegularExpressions.Regex.Replace(varStr,"\\u\d{4}","")

Regards,

1 Like

This is strange, the results on the output I don’t see any \u0007:

But when I double cllick to show message details I see it:

Hi,

It seems actual data is \u0007 character.
For now, can you try the following expression?

System.Text.RegularExpressions.Regex.Replace(varStr,"\u0007","")

Regards,

1 Like

This is the flow:

then i output that Outcome2

it’s solved, thank you so much @Yoichi
I really appreciate your help

1 Like

FYI,

The following expression will also work.

varStr.Replace(ChrW(7),"")

Or if you need to remove character from \u0000 to \u0007, for example, the following works.

System.Text.RegularExpressions.Regex.Replace(varStr,"[\u0000-\u0007]","")

Regards,