CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI:
Not all entries added


New User

Nov 4, 2009, 11:42 AM

Post #1 of 1 (5152 views)
Not all entries added Can't Post

So I wrote a scipt to take a csv file and upload it to a database. It works fine except the csv files have some bad ascii characters in them (like ... as one character) so the ascii value is outside the standard set. Perl see's this as an escape or something and doesn't add the line. Is there an easy way to check to make sure all the values are within the normal ascii range so I don't get a lot of missing files because of special characters? Or can I handle them in a special way? Thanks! part of my code is below.


#Set's the fields of the parsed file into a data array

#Checks to make sure that all the lines aren't blank if not then continue.
if($#data == 20)
#Takes each field in the data array and sets it to the
#corosponding position in the database. If there is an error print
#out the message and quit


or die "Couldn't execute: $DBI::errstr";
#increase the counter
#If it fails print out the line that we couldn't parse
print "Unable to parse CSV line: ",$_, "\n";


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives