I need to remove some characters that get inserted into a DCR when users copy and paste from Word or other editors. In one example I have seen the the characters –. I looked at the hex codes and they are E2 80 AND 93. I tried to use the line '$path =- s [\xE2]g;' but it does not replace the character. Any ideas?Thanks
Please tell us that your line of Perl code is a typo. Funny thing is, it's syntactically correct.What it does however has notning to do to pattern search/replace.$path =~ s/\xE2/*/g;
Typo? No I do not think so
my $path = 'âx';print "$path\n";$path =~ s/\xE2/*/g;print "$path\n";...C:\temp>perl foo.plΓx*xC:\temp>
Please reread your original post carefully. You will see that you have minus(-) instead of tilda(~).Please note that although you can use almost anything as a pattern delimiter square brackets are bad choice IMO. They denote regex class so you may not be able to use this syntax element if needed. my $path = 'âx';print "$path\n";$path =~ s/\xE2/*/g;print "$path\n";...C:\temp>perl foo.plΓx*xC:\temp>
I created a test perl file and ran the test and the special characters were removed. If I added it to my template they were not.
Ah... You are not the first one who's getting burned by Perl 5.8 native UTF-8 support. Do the following once before translation:$path = Encode::encode_utf8($path);$path =~ s...
I tried that but it did not translate xe2 to something else. Any more ideas? I really appreciate the help. $path =~ Encode::encode_utf8($path); $path =~ s [\n][]g; # translate all '\n' into '' $path =~ s/\xe2/*/g; $path =~ s [\x93][anything]g;
I tried that but it did not translate xe2 to something else. Any more ideas? I really appreciate the help. $path =~ Encode::encode_utf8($path); $path =~ s [\n][<br />]g; # translate all '\n' into '<br />' $path =~ s/\xe2/*/g; $path =~ s [\x93][anything]g;