03-05-2020 08:40 AM
Hi,
A piece of code that uses a .lst file has stopped working in DIAdem 2019. The code uses FileNameGet to obtain multiple filenames and saves the list to a .lst ASCII file. It then uses the FR function to read each line.
However, in DIAdem 2019, the first line comes back as the string ÿþm
Does anyone know why this is or how to correct it?
I see that there is the alternative function TextFileReadLn, but before I go ahead and change my code I wanted to ask if there is something else that I'm missing.
Thanks, Simon.
Solved! Go to Solution.
03-09-2020 01:58 PM
Hi Simon,
When I get characters that are odd in a text file, it usually means that I have a mismatch between ASCII or unicode formating.
Best way to check is to run notepad++ or ultraedit (you can not see this in regular notepad) and see what encoding the file is. Most likely Notepad++ will say it is unicode.
You can read unicode(utf-8 in DIAdem, just just have to change one argument..
Paul
03-10-2020 03:24 AM
Thanks Paul.
Notepad++ says the encoding is UCS-2 LE BOM. Naturally, this means nothing to me. I should also re-stress that the .lst file was written by DIAdem using its FileNameGet function so it seems odd that its FR function can't read its own files.
I'm afraid I don't know how to act on your last statement. The FR function only has two arguments and neither seem to relate to file format.
If you could clarify then I'd be grateful.
Thanks.
03-10-2020 06:34 AM
FileNameGet creates a Unicode file and FR supports only ANSI ASCII.
I think you have a few options.
Greetings
Walter
03-10-2020 09:30 AM
Thanks Walter.
The help files clearly state that FileNameGet specifies an ASCII file. Nonetheless, thanks for the options. I have chosen to go with TextFileRead as I can do so with the least modification of my script.
Regards.