As I am pig headed, I continued to fight with the 4th file, the one named "Отчет.txt".
I opened it by hand then ran this short script :
tell application "TextEdit" activate text of document 1 end tell
It worked.
I tried with :
tell application "TextEdit" activate set MyDoc to text of document 1 end tell This one froze.
I looked in Hexedit and saw that the file starts with FFFE which is the UTF16 Low Endian BOM. Just after the BOM I saw : FC FF FC FF FC FF FC FF FC FF FC FF FC FF FC FF which seems to be odd. In TextEdit, I inserted the string "abcd" at the very beg and saved. Fine, after that the BOM is here but the 16 extraneous bytes are gone. In TextEdit I deleted "abcd" and saved again. After that the file seemed to be clean but the second script continued to freeze.
I opened the original in Pages then exported as text. I got a file encoded in Utf8 with no BOM.
Both scripts behave well upon this late file.
ILJA SHEBALIN seems to be unable to explain that and worse he seems to be unable to understand the description of what is striking.
With a bit of luck one of you will be able to try to reproduce what I did and report what he got.
On my side I will apply the "cleaning" process to the three other docs so that, with a bit of luck, I will be able to run the main script.
Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) vendredi 26 mai 2017 17:21:43
|