Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Regexp to convert high-bit (?) characters to character entites

by epoptai (Curate)
on Jul 10, 2002 at 04:51 UTC ( [id://180676]=note: print w/replies, xml ) Need Help??


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.

  • Comment on Re: Regexp to convert high-bit (?) characters to character entites
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://180676]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found