Hi,
I'm struggling with a small python script. What I want is that the script should export all selected attributes from at select by location operation (on two feature layers) to a text file. The script works fine when attribute data doesn't contain æøå, but when æøå is in it only returns (write to txt file)those attributes (road names) from the top in which æøå is not a part of det text string. To me it seems as if the cursor stop when it bumps into æøå. I'm sure it's a matter of encoding, but i don't know how to solve this? 😞
Does anyone know how to solve this issue? Here is the code (it is the field "VEJNAVN" that contains æøå):
******
import sys, arcgisscripting, string
gp = arcgisscripting.create(9.3)
ADRESSER = sys.argv[1]
gp.overwriteoutput = 1
try:
logfile = "C:\\Documents and Settings\cg21mj\\Skrivebord\\logfile.txt"
log = open(logfile, "w")
log.write ("OBJECTID"+";"+"KOMMUNENR"+";"+"VEJNAVN"+";"+"VEJKODE"+";"+"HUSNUMMER"+";"+"NKLASSE"+";"+"TSTAND\n")
rows = gp.SearchCursor(ADRESSER)
row = rows.Next()
while row <> "":
result0 = row.GetValue("OBJECTID")
result1 = row.GetValue("KOMMUNENR")
result2 = row.GetValue("VEJNAVN")
result3 = row.GetValue("VEJKODE")
result4 = row.GetValue("HUSNUMMER")
result5 = row.GetValue("NKLASSE")
result6 = row.GetValue("TSTAND")
log.write(str(result0) + ";" + str(result1) + ";" + str(result2) + ";" + str(result3) + ";" + st(result 4) + ";" + str(result5) + ";" + str(result6) + "\n")
row = rows.Next()
log.close()
except:
print gp.GetMessages()
*****
Thanks in advance!
Regards,
Morten
GIS coordinator, Denmark