Title: Unicode text to integer conversion from file
data
Can anyone explain what is going on here? Result is same on Intel
iMac or PPC iBook (Both Tiger):
-- integer from Unicode text test
on TempFile() "" & (path to "temp"
from user domain) & "temp_file"
end TempFile
set f to TempFile()
try set n to open for access file
f with write permission set testText to "59" as Unicode
text set eof n to 0 write testText to n
on error errMsg display dialog
errMsg
end try
close access n
set theFile to (open for access file f)
set theRawData to (read theFile) as Unicode text
close access theFile
display dialog "comparison result is:" & comp as
text
try set problem to
"fifty9" set n1 to fifty9 as integer set problem to
"theRawData" set n2 to theRawData as
integer display dialog "coercion successful"
on error errMsg display dialog problem &
": " & errMsg
end try
----------------------------------------------------------
tell current application path
to "temp" from user domain alias "Main
Volume:Users:dhall:Library:Caches:TemporaryItems:" open for access file "Main
Volume:Users:dhall:Library:Caches:TemporaryItems:temp_file"
with write permission 166 set eof 166 to 0 write
"59" to 166 close
access 166 open
for access file "Main
Volume:Users:dhall:Library:Caches:TemporaryItems:temp_file" 167 read 167 "59" close access 167 display dialog "theRawData is
|59|" {button returned:"OK"} display dialog "comparison result
is:true" {button returned:"OK"} display dialog "theRawData: Can't make \"59\" into type
integer" {button returned:"OK"}
end tell