If you wanted to replace the offending character with its HTML entity, without using modules, you could maybe do something like this, which should work in many cases, (or use the commented line instead to replace the character with a space):
for (my $x=0;$x<length($string);$x++) { if (ord(substr($string,$x,1))>127) { substr($string,$x,1)='&#'.ord(substr($string,$x,1)).';'; # substr($string,$x,1)=' '; # or use this line instead } }
... or, if you just wanted to know what a character is meant to be, then you could do something like this:
for (my $x=0;$x<length($string);$x++) { print ord(substr($string,$x,1)),"\t",substr($string,$x,1),"\n"; }
Hope that helps, although all the modules and tools mentioned above are useful methods too. (and I'm sure some guru could likely condense the code above into a single line).
In reply to Re: unknown character in between text
by DanielSpaniel
in thread unknown character in between text
by soumyapanda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |