jschofield Posted April 10, 2007 Share Posted April 10, 2007 Hello fellow phpers, I have a script here that keeps putting a return or pipe character between numbers and letters. Please take a look and see what you think. I am clueless on how this is doing this and/or how to fix the problem. I have attached my scripts and data. The attendanceinof.txt is my input file and the Livingston.csv is my output file. Thanks everyone. This will be a huge help tome to get this figured out. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/46492-solved-return-character-after-each-letter-or-number/ Share on other sites More sharing options...
wildteen88 Posted April 10, 2007 Share Posted April 10, 2007 With the provided scripts i got strange character outputs This was because the data in the attendanceinfo.txt file was sort of corrupt, most probably due to the encoding or something. This is what was causing the csv file to have all wierd data underscores after ever character etc. However looking at the text file closely I managed to identify each line in the text file. For some reason on line returns it had aload of square block ype symbols . I had to go in and manually and edit each line - very tedious work! Find and Replace didn't work. After formatting the text files so there is no corruption. I tested again. This time it displayed correctly and the data written to the csv file was readable. Example corruption when opening the txt file after download (lines 1-7): Ref: ATT.515D LIVINGSTON SCHOOL DISTRICT Page 1 䐀愀琀攀㨀 ㈀⼀㈀⼀ 㜀 㔀 䰀䤀嘀䤀一䜀匀吀伀一 䠀䤀䜀䠀 匀䌀䠀伀伀䰀ഀഀ Time: 9:40:52 Student Absences from 2/13/07 to 2/13/07 Absence Types: (Au) (Ae) (T ) ⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀഀഀ Homeroom Homeroom Daily 匀琀甀搀攀渀琀 ⌀ 匀琀甀搀攀渀琀 一愀洀攀 䌀氀 吀攀愀挀栀攀爀 一甀洀戀攀爀 ㈀ ㌀ 㐀 㔀 㘀 㜀 㠀 㤀 刀攀愀猀漀渀 䐀愀琀攀ഀഀ ------------------------------------------------------------------------------------------------------------------------------------ (the ? marks is the [] type characters I see - the browser renders these characters differently) When reformatted to correct format, example lines 1-7: Ref: ATT.515D LIVINGSTON SCHOOL DISTRICT Page 1 Time: 9:40:52 Student Absences from 2/13/07 to 2/13/07 Absence Types: (Au) (Ae) (T ) Homeroom Homeroom Daily ------------------------------------------------------------------------------------------------------------------------------------ I have attached the reformatted txt file. Your code should work now. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/46492-solved-return-character-after-each-letter-or-number/#findComment-226357 Share on other sites More sharing options...
jschofield Posted April 12, 2007 Author Share Posted April 12, 2007 Hello Wildteen88. Thank you for the help. You actually saved my butt from my boss. I used your file that you had corrected and it worked great. Your the man. Thanks again!! Johnnie Quote Link to comment https://forums.phpfreaks.com/topic/46492-solved-return-character-after-each-letter-or-number/#findComment-227631 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.