http://www.perlmonks.org?node_id=1015956

IanD has asked for the wisdom of the Perl Monks concerning the following question:

OK I have searched and searched here and can't find a solution for this.

I have a string that contains copied and pasted text from word or some mac thing and it contains non ascii apostrophies and quotes.

eg (all in one long string):
Australia’s ‘Powder Capital’ and ... xxx said “This is a fantastic start to the season”
I want to replace all the ‘ and ’ with the ascii ' and the “ and ” with the ascii "

I can get rid of them with this:
$data_string =~s/[^[:ascii:]]//g;

But I want to replace them, not remove them and can't for the life of me work out the right regex to do this.

Also what reference do you use for the lookup. I have been using this:
http://www.ascii.cl/htmlcodes.htm

Which could be my problem. As down the track I am sure I will want to replace things like ä with a etc as well.

Thanks.