|Think about Loose Coupling|
Replacing non ascii in stringby IanD (Initiate)
|on Jan 30, 2013 at 04:26 UTC||Need Help??|
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:
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:
Which could be my problem. As down the track I am sure I will want to replace things like ä with a etc as well.