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),“-”).
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 System.Text.RegularExpressions.Regex.Replace(input,"([^\x00-\x7F]+)","")
@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.