Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 romping around the Monastery: (13)
As of 2014-10-23 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls