Re: Converting AppleScript Routine to shell, how to write BOM to beginning of file?
Re: Converting AppleScript Routine to shell, how to write BOM to beginning of file?
- Subject: Re: Converting AppleScript Routine to shell, how to write BOM to beginning of file?
- From: Richard Rönnbäck <email@hidden>
- Date: Fri, 24 Aug 2007 22:45:49 +0200
- Thread-topic: Converting AppleScript Routine to shell, how to write BOM to beginning of file?
Wonderful!
Thanks Mark! It's great to get help with a solution that just works, and to
also get a clear explanation is invaluable!
I am starting to come to grips with character encodings but your answer also
learned me something very useful about the echo command and octal
representation of characters as well
Thanks!
> Från: "Mark J. Reed"
> Datum: Fri, 24 Aug 2007 15:52:12 -0400
> Till: Richard Rönnbäck, Applescript Users
> <email@hidden>
> Ämne: Re: Converting AppleScript Routine to shell, how to write BOM to
> beginning of file?
>
> A brief terminology clarification: the BOM is by definition one
"character".
> When encoded as UTF-8, it is represented by three bytes
with the decimal
> values you gave. The AppleScript term "ASCII
character" is thus doubly a
> misnomer here.
In bash you can output arbitrary bytes by using the -e ("honor
> Escape
sequences") option to the echo command and putting backslash
> octal
escapes in the string. Decimal 239 is octal 357;decimal 187 is
> octal
273; and decimal 191 is octal 277. So you can output a BOM with
> this
command:
echo -ne '\357\273\277'
(The -n prevents echo from adding a
> newline after the bom)
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden