Replace ’ characters from string
Replace ’ characters from string
(OP)
I'm reading a CSV file into a c# script and trying to replace certain characters that are causing problems. However, I can't seem to replace ’ which needs to be an apostrophe.
I have tried stripping non-ascii characters with a regex but that leaves a ™ which I then cannot replace either.
Any ideas on how I can replace these unwanted characters?
The source file is being accessed remotely so I have no access to it in terms of changing the encoding
Thanks
Web Development Manager
http://www.freemoneyoff.co.uk
http://www.freemoneysurveys.co.uk
http://www.freemoneyresource.co.uk
I have tried stripping non-ascii characters with a regex but that leaves a ™ which I then cannot replace either.
Any ideas on how I can replace these unwanted characters?
The source file is being accessed remotely so I have no access to it in terms of changing the encoding
Thanks
Web Development Manager
http://www.freemoneyoff.co.uk
http://www.freemoneysurveys.co.uk
http://www.freemoneyresource.co.uk
RE: Replace ’ characters from string
http://stackoverflow.com/questions/7178695/c-sharp...
RE: Replace ’ characters from string
I can now replace the first two characters using unicode references with a regular expression or simple replace but the TM symbol is still not being replaced.
For example, this does nothing
CODE
However, this removes the †characters
CODE
This leaves the TM character but I need to replace the whole ’ string with a single quote. I do not want to try and replace the TM separately as there will be occasions where there is a valid TM character. Having said that I am having no luck replacing the TM on its own anyway.
I have also tried replacing using other codes for the trademark symbol such as ™ ™ and ™ with no luck.
Any ideas?
Web Development Manager
http://www.freemoneyoff.co.uk
http://www.freemoneyresource.co.uk
http://www.freemoneysurveys.co.uk
RE: Replace ’ characters from string
RE: Replace ’ characters from string
Web Development Manager
http://www.freemoneyoff.co.uk
http://www.freemoneyresource.co.uk
http://www.freemoneysurveys.co.uk
RE: Replace ’ characters from string
For example
CODE
A bit clunky but it works. Would still like to know a solution using replace but this will have to do for now.
Web Development Manager
http://www.freemoneyoff.co.uk
http://www.freemoneyresource.co.uk
http://www.freemoneysurveys.co.uk