in reply to What Voodoo Encoding does RTF use for > ASCII Chars?
$x =~ s/([\x00-\x1F\ x7F-\xFF])/"\\'" .(unpack("H2",$1))/eg; ^
Assuming you're talking about Latin-1 characters (as the range up to just \xFF suggests), it should suffice to get rid of the indicated space...
my $x = "foo à, è, ì, ò, ù bar"; $x =~ s/([\x00-\x1F\x7F-\xFF])/"\\'" .(unpack("H2",$1))/eg; print $x; # foo \'e0, \'e8, \'ec, \'f2, \'f9 bar
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: What Voodoo Encoding does RTF use for > ASCII Chars?
by tosh (Scribe) on Mar 20, 2012 at 22:18 UTC | |
by Eliya (Vicar) on Mar 20, 2012 at 22:31 UTC |