Jump to content

Recommended Posts

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]

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]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.