Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 surveying the Monastery: (7)
As of 2015-07-04 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls