Stephan_Neumann
Programmer
Problem solved: turns out that Foxpro on Windows 10 automatically writes (some) special characters as double-byte characters. By replacing ÿ with chr(255) and û with chr(251) it is working again. Thanks Griff for the tip to use a hex editor!
I create an array of X data from a database and write it to a secundary file to be merged with Word or WordPerfect files. This has worked since 1995 without a flaw, currently on a Windows Server 2012 machine. In a new Windows 10 stand-alone version I'm recreating the program and use exactly the same code, and it doesn't work. It writes the data but with wrong control characters.
I have been looking at codepages, etc. but no clue. Any help appreciated!
Code:
hendel=fcreate(mhome+'nu.txt')
fwrite(hendel,'ÿWPC^'+chr(0)+chr(0)+chr(0)+chr(1)+chr(10))
fwrite(hendel,chr(0)+chr(1)+replicate(chr(0),4)+'ûÿ'+chr(5)+chr(0)+'2'+replicate(chr(0),5)+chr(6))
fwrite(hendel,chr(0)+chr(8)+replicate(chr(0),3)+'B'+replicate(chr(0),3)+chr(8)+chr(0)+chr(2)+replicate(chr(0),3)+'J')
fwrite(hendel,replicate(chr(0),3)+chr(1)+chr(0)+chr(18)+replicate(chr(0),3)+"L"+replicate(chr(0),13)+chr(8)+chr(0)+"|")
fwrite(hendel,chr(0)+'x'+replicate(chr(0),5)+'Jan 01, 1980'+replicate(chr(0),6))
For teller=1 To Alen(F)
F[teller]=trim(F[teller])
fwrite(hendel,f[teller]+end_field())
Next
fwrite(hendel,end_record())
fclose(hendel)
release F
return .T.
function END_FIELD
return chr(222) + "1" + chr(04) + chr(0) + chr(04) + chr(0) + "1" + chr(222)+chr(10)
function END_RECORD
return chr(222) + chr(52) + chr(6) + chr(0) + chr(0) + chr(0) + chr(6)+ chr(0) + chr(52) + chr(222) + chr(12)
I create an array of X data from a database and write it to a secundary file to be merged with Word or WordPerfect files. This has worked since 1995 without a flaw, currently on a Windows Server 2012 machine. In a new Windows 10 stand-alone version I'm recreating the program and use exactly the same code, and it doesn't work. It writes the data but with wrong control characters.
I have been looking at codepages, etc. but no clue. Any help appreciated!
Code:
hendel=fcreate(mhome+'nu.txt')
fwrite(hendel,'ÿWPC^'+chr(0)+chr(0)+chr(0)+chr(1)+chr(10))
fwrite(hendel,chr(0)+chr(1)+replicate(chr(0),4)+'ûÿ'+chr(5)+chr(0)+'2'+replicate(chr(0),5)+chr(6))
fwrite(hendel,chr(0)+chr(8)+replicate(chr(0),3)+'B'+replicate(chr(0),3)+chr(8)+chr(0)+chr(2)+replicate(chr(0),3)+'J')
fwrite(hendel,replicate(chr(0),3)+chr(1)+chr(0)+chr(18)+replicate(chr(0),3)+"L"+replicate(chr(0),13)+chr(8)+chr(0)+"|")
fwrite(hendel,chr(0)+'x'+replicate(chr(0),5)+'Jan 01, 1980'+replicate(chr(0),6))
For teller=1 To Alen(F)
F[teller]=trim(F[teller])
fwrite(hendel,f[teller]+end_field())
Next
fwrite(hendel,end_record())
fclose(hendel)
release F
return .T.
function END_FIELD
return chr(222) + "1" + chr(04) + chr(0) + chr(04) + chr(0) + "1" + chr(222)+chr(10)
function END_RECORD
return chr(222) + chr(52) + chr(6) + chr(0) + chr(0) + chr(0) + chr(6)+ chr(0) + chr(52) + chr(222) + chr(12)