perlquestion
IanD
<p>OK I have searched and searched here and can't find a solution for this.
</p>
<p>I have a string that contains copied and pasted text from word or some mac thing and it contains non ascii apostrophies and quotes.
</p>
eg (all in one long string):
<code>
Australia’s ‘Powder Capital’
and ... xxx said “This is a fantastic start to the season”
</code>
I want to replace all the ‘ and ’ with the ascii ' and the “ and ” with the ascii "
<p>I can get rid of them with this:<br>
<code>$data_string =~s/[^[:ascii:]]//g;</code>
</p>
<p>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.
</p>
<p>Also what reference do you use for the lookup. I have been using this:<br>
[http://www.ascii.cl/htmlcodes.htm]
</p>
<p>Which could be my problem. As down the track I am sure I will want to replace things like ä with a etc as well.
</p>
<p>Thanks.</p>