Take a look at this text below:
f
Take a look at this text below:
f
(text missing)
Copy and paste it into a text document and try and delete the characters singly. There is something invisible in between each character. You have to hit the delete key 2x to delete each character.
This is how I made this text above, using this part of a script
repeat with eachFile in picList
set myData to (read eachFile as text using delimiter return)
set howMany to count of items in myData
set fileName to name of (info for eachFile)
try
copy (open for access file (watchedFolder & "pOS.txt") with write permission) to fileRef
repeat with i from 1 to howMany
write (item i of myData & "," & fileName & return) to fileRef
end repeat
close access fileRef
on error
close access fileRef
end try
end repeat
Only I can’t figure out where the extra character is coming from. If I run the script with event log on, I can copy the text from the part of the event log where the instruction says
write "fdb-2005-12-30-a-001.pdf,fdb_20051230_A16_1-16.pdf, [11]: OK,Report_2006_01_03_22_37.txt" to 179
and there are no extra characters
I have to get rid of them, they are wrecking everything. What are they, and where are they coming from?
JA
Holy crap… I can’t even paste the text into a message. There is something after each character (obviously after that first “f”) that made all the text after it disappear.
Somebody help me… I’m going to jump off the roof
JA
You’re writing out Unicode text as UTF16 data. The ‘write’ command’s behaviour changed in 10.4; if you pass it Unicode text it’ll automatically write it to file as Unicode text if you don’t specify a type in its ‘as’ parameter. In 10.3 and earlier, if you passed Unicode text to ‘write’ and didn’t provide an ‘as’ parameter, it’d [try to] coerce it to string and write that. The new behaviour is more intelligent; however, it does cause compatibility issues with older laissez-faire code and catches out folk who don’t know about Unicode. The solution, not surprisingly, is always to specify how you want text data written (UTF8 is a common choice when working with Unicode text). See this recent thread for more information:
There are days when I wonder what the h*ll I think I’m doing here…
Thank you both for the “as string”. I’ve followed the links provided, done some required research and I will store this away in my brain, enfeebled as it may be :rolleyes:
JA