http://qs321.pair.com?node_id=180676


in reply to Regexp to convert high-bit (?) characters to character entites

Here's a useful little sub from XML::TiePYX that mirod turned me on to:

sub encode { my($text) = @_; $text =~ s{([\xc0-\xc3])(.)}{ my $hi = ord($1); my $lo = ord($2); chr((($hi & 0x03) <<6) | ($lo & 0x3F)) }ge; return $text; }

--
Check out my Perlmonks Related Scripts like framechat, reputer, and xNN.