I'm not sure what those characters are, but when I am trying to identify unusual characters, I use the ord function:
#!/usr/bin/env perl
use warnings;
use strict;
my $str = 'abcde';
for (split //, $str) {
print "$_:", ord $_, ":\n";
}
Once you identify the characters, it will be easier to figure out a way of eliminating them. | [reply] [d/l] |
Somehow, character code point numbers are always easier for me to grok (and look up on code charts) when shown in hex; also, it can help to put in a "safe" placeholder for the non-printable ones -- otherwise, they can sometimes make the display somewhat confusing:
for (split //, $str) {
printf( "%s: %02x\n", (/[[:print:]]/) ? $_:".", ord());
}
| [reply] [d/l] |
If you're in *nix land, you can also try cat -vet and od commands to look for strange characters in files.
---
echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'
Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.
| [reply] |
You can also try something like this (do NOT try it on the original until you verify it works the way you want on a copy).
perl -pi -e 's/[^\s[:print:]]//g' [filename]
| [reply] [d/l] |
I have a mediocre solution for this.
Enter visual mode, highlight the chars in question.
Enter command mode..
:%s/$action//g
where it says $action, paste, middle click- on linux.
I know that either in visual or insert, hihghlighting will NOT work on these characters.
I think all this happens because of ASCII / UTF8 conversion.. Again, I my 'solution' is mediocre, but it should help you look into it deeper if you so desire. | [reply] [d/l] |