There's more than one way to do things | |
PerlMonks |
Regex to trim non Ascii charactersby Yllar (Novice) |
on Sep 26, 2015 at 10:46 UTC ( [id://1143087]=perlquestion: print w/replies, xml ) | Need Help?? |
Yllar has asked for the wisdom of the Perl Monks concerning the following question: I am working on Windows Environment, I want to trim all non-Ascii characters and want only ascii range characters,numbers and symbols.Please help My Input Was : This is a simple text just for test purpose only ascii text 12345678910-=[];'#/.,-! " £ $ % ^ & * ( ) _ + { }~@:<>?|– Now I am using JSON to decode my input data which decodes it as follows: This is a simple text just for test purpose only ascii text12345678910-=[];\'#/.,\\-!\"\u00A3$%^&*()_+{}~@:<>?| \u2013 Now I am sending this decoded data to my Program to replace this unicode(utf-8) and other non-ascii characters with space/or some printable characters(I mean i want to print only ascii range characters) So, I tried all of the following in perl.
The output still is: "This is a simple text just for test purpose only ascii text12345678910-=[];'#/.,\-!\"\x{a3}\$%^&*()_+{}~\@:?|\x{2013}";
Back to
Seekers of Perl Wisdom
|
|