Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange character in field

Status
Not open for further replies.

Webrookie

Programmer
May 18, 2000
112
US
This is the reason for my index issue thread earlier. It took some looking into but i believe this is the problem.

I get my data from a website which allows me to save the data to an excel file in my HD. The Excel Spreadsheet does have formatting (colored rows, bold fonts, etc..). When I export to a tab delimited file and subsequently append into a dbf, my indexes don't seem to respond properly. Well I did some messing around, and every field has a character at the end of the value that comes out to an asc of 160. It actually appears to be a space, but when i count the number of characters in the field it comes out to 10, but len(alltrim()) comes out to 11. weird, huh?

Well, I tried going directly from Excel to DBF, and when viewing the DBF, this last character actually is actually represented as a ÿ

YUCK! now i suppose i could just go field through field row by row and replace each field with len(field)-1, but I was just curious if anyone else has seen something like this?
 
Webrookie

When I export to a tab delimited file

Have you tried other formats of export? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
You can transform your tab delimited file this way.

Brian

varinfile="your_tab_file.txt"
varoutfile="your_tab_file_minus_strange_char.txt"

lnhandle= fopen(varinfile)
lnNewFile= fcreate(varoutfile)

do while not Feof(lnHandle)
lcString = chrtran(fgets(lnHandle,8000),chr(160),"")
= fput(lnNewFile,lcString)
enddo
close all
 
webrookie...

Or look at STRTRAN

REPL ALL myfield WITH STRTRAN(myfield,CHR(160),SPACE(1)) FOR CHR(160) $ myfield

HTH - Wayne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top