Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: ASCII, Unicode, use utf8: My Story of Discovery

by richardX (Pilgrim)
on Nov 04, 2002 at 04:13 UTC ( #210118=note: print w/ replies, xml ) Need Help??


in reply to ASCII, Unicode, use utf8: My Story of Discovery

I have had my log parsing routines crash because of invalid ASCII characters, so I run this code against it, which cleans up the bad boys found.

# loop through the file zapping the bad characters found while(<FILE>) { $lineBuff = $_; # remove upper ascii $lineBuff =~ s/([\x7F-\xFF]+)/$delimiter/gm; # remove lower ascii $lineBuff =~ s/([\x00-\x1F]+)/$delimiter/gm; $lineBuff =~ s/\%//gm; # send the clean data to the output file print OUT "$lineBuff\n"; }

Richard

There are three types of people in this world, those that can count and those that cannot. Anon


Comment on Re: ASCII, Unicode, use utf8: My Story of Discovery
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-07-23 22:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (154 votes), past polls