Thanks Emmanuel and Mark!
Writing the BOM as string and the rest as string works!
Emmanuel, I did find the excellent Satimage page on Unicode, but I was
unable to deduct the solution for this particular problem, with BOM in a
UTF8 file. No doubt my fault.
Perhaps others, like me, will visit the page looking for the answer to the
same problem I had
. In that case, adding the solution you and Mark showed would make the page
Again, thanks for your help!
> Från: Emmanuel <email@hidden>
> Datum: Wed, 25 Oct 2006 21:35:37 +0200
> Till: AppleScript <email@hidden>
> Ämne: Re: Writing to file as UTF8 with BOM ?
> At 9:22 PM +0200 10/25/06, Richard Rönnbäck wrote:
>> I have an application that requires an import file encoded as UTF8
>> with a leading BOM.
>> After examining some working files with proper encoding in BBedit I
>> have concluded that the BOM seems to consist of three characters, so
>> I thought I could just concatenate those with the actual data and
>> write to file, like this:
>> set myBom to ((ASCII character 239) & (ASCII character 187) & (ASCII
>> character 191))
>> set myString to "Hej Hå"
>> set myCS to myBom & myString
>> set myTestFile to (open for access file "Macintosh
>> HD:Users:richardr:Desktop:tjong.txt" with write permission)
>> write myCS to myTestFile as «class utf8»
>> close access myTestFile
>> However, neither that, nor any other combination I can think of
>> seems to do the trick.
>> What am I missing?
> I would write the BOM as ASCII:
> write myBom to myTestFile
> write myString to mytestFile as «class utf8»
> You may find our page on Unicode and AppleScript useful:
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/mailman//archives/applescript-users
> This email sent to email@hidden
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden