Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange Characters following character data in field
Message
From
28/12/2006 23:15:48
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01180814
Message ID:
01180821
Views:
13
>I am getting strange looking characters following the data in the character fields. I even padded with Blanks in order to try to compensate for this.
>
>
>SELECT Patients
>DO WHILE NOT FEOF(nFileHandle)
>  * Grab 112 characters, strip off the first nine
>  cString=FREAD(nFileHandle, 112)
>  lcFirstName=PADR(ALLTRIM(SUBSTR(cString, 10, 29)), 29, " ")	&& First Name
>  lcLastName =PADR(ALLTRIM(SUBSTR(cString, 39, 29)), 29, " ")	&& Last Name
>  lcSSN      =PADR(ALLTRIM(SUBSTR(cString, 68, 11)), 11, " ")   && SSN
>  lcDOB      =SUBSTR(cString, 97, 8)	&& Date of Birth
>  lcDOBMonth =SUBSTR(lcDOB,5,2)
>  lcDOBDate  =SUBSTR(lcDOB,7,2)
>  lcDOBYear  =LEFT(lcDOB,4)
>  lcDOBDate  =lcDOBMonth + "/" + lcDOBDate + "/" + lcDOBYear
>  ldDOB      =CTOD(lcDOBDate)
>  lcGender   =PADR(ALLTRIM(SUBSTR(cString, 106, 1)), 1, " ")	&& Gender
>  APPEND BLANK
>  REPLACE ;
>	firstname WITH lcFirstName, ;
>	lastname  WITH lcLastName, ;
>	ssn       WITH lcSSN, ;
>	dob       WITH ldDOB, ;
>	Gender    WITH lcGender
>ENDDO
>
>Has anyone run into this? Do I need to do some kind of low-level cleaning up first?

You can look up these characters using strconv(yourfield, 16) and see if there's anything that's not between 0h20 and 0h7f - those would be the suspects. You can then filter them out using cString=chrtran(cString, "{your strange chars here}", space({number of strange chars}))

Of course, knowing your hex codes would help a lot - you could just view the source file in any hex viewer and see what's up. Nothing bad there, just bytes.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform