Replace special charater to em-dash

I am viewing a report in an application with the string as “Associate Director Quality Value Stream Lead - Bul”. But when I export that data to report and download it as a csv file (default downloading as csv file) I am seeing the string as “Associate Director Quality Value Stream Lead – Bul”.

I am trying to replace the special characters " – " with “”. But I am unable to do so.

I am unable to replace that single double quote available in the string. If you observe closely that single double quote is not similar to keyboard double quote.

I tried with string.replace(“–”,"-") , it gave me an error saying double quote has to be provided.
So I tried replacing individually, i.e first string.replace(“—,"") and then string.replace(chr(34),"-").

Still no Luck. Any thoughts?

Thanks in advance,


Can you try the following?

System.Text.RegularExpressions.Regex.Replace(text,"[^A-Za-z0-9 ]+","-")

This expression replace except alphanumeric and whitespace to “-”.
If you need to add characrter to replace, please add character inside [^ and ].


You see — due to issues with encoding. You can you the below to replace any non-ascii characters (so it will still allow for ascii special characters like *()!@#$ etc…) with a space


@jack.chan thanks for your reply.
Your regex is working fine.
Actually I want to replace that those non-ascii charaters to their respective symbols.
In this case — represents a em-Hyphen, I am replacing it with a em-hyphen.
But I might get a non-ascii charaters other than —. i think we need to find a way on fixing the string format rather than replacing.

Any thoughts?

What application are you using to download the csv file? Is it SAP?

could you try to download your csv file as utf-8 format? Or save your csv as utf-8 format?

It’s not SAP. The file is downloading with just one click. I am unable to do download the file via save as.

I tried to save the file as utf-8 but still it is giving me same string.


can you export it as something other than csv? like xlsx? and are you able to change the export settings of your application to be utf-8 format?

Found the resolution. I used read csv activity instead of read range activity and provided the encoding format as utf-8 in the properties.

I am getting the expected result.

Thank you for your inputs though. I appreciate your help.


1 Like

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