Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Character Sets
Message
De
11/09/2014 05:47:11
 
 
À
11/09/2014 05:41:17
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01607355
Message ID:
01607374
Vues:
48
>>>>>Hi All
>>>>>
>>>>>I am receiving text (TXT) files from a 3rd party entity. I read the file in using FILETOSTR(), amend it, and then write it out to another TXT file using STRTOFILE(). Someone has now asked me what character set we are using for the output file. How do I find that out or answer this question?
>>>>>
>>>>>TIA
>>>>
>>>>FILETOSTR() / STRTOFILE() work on plain bytes. They do not do any conversion. IOW you can read a binary as well.
>>>>If you do not play around with stuff related to that problem the right answer would be: The output file has the same codepage as the input - if any.
>>>
>>>IOW, what Borislav said is still true, not because of anything that these two functions do, but because of how the app composed the string. If there were any characters in it which were codepage specific, they were done according to those settings, and written into the file as bytes.
>>
>>So are we all saying that if I:
>>
>>1) Read in the file - FILETOSTR()
>>2) Calculate a checksum on it - SYS(2007)
>>3) Add the checksum to the file - concatenate the strings, and
>>4) Write it back out to a new file - STRTOFILE()
>>
>>... then the codepage / character set of the new file is identical to the codepage / character set of the original file?
>
>Since the checksum is just digits, which are the same in all codepages, you couldn't have added any content which would be in a codepage different from the rest of the file. Concatenating the strings, I guess, shouldn't do any conversion... however, the safer, just-in case method would be to, in step 3, do strtofile(lcChecksumString, lcFile, 1). That is sure to just append the bytes at the end of the file, without touching it otherwise.

Thanks Borislav, Lutz, and Dragan. I think I got the answer that will work.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform