Converting AppleScript Routine to shell, how to write BOM to beginning of file?
Converting AppleScript Routine to shell, how to write BOM to beginning of file?
- Subject: 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 19:25:36 +0200
- Thread-topic: Converting AppleScript Routine to shell, how to write BOM to beginning of file?
I am converting an AppleScript solution to something that more heavily
relies on shell scripting and one of the problems I have stumbled upon is
how to create UTF-8 encoded files with a leading BOM.
The stuff I am writing, either as the output of shell commands, or stored in
variables, is already UTF-8, so the encoding is right, but if I try to just
write it to file, like this
$myContent >/somefile.txt
then obviously it has no BOM. In AppleScript I created (with kind assistance
by people on this list) the BOM by combining these three characters:
set myBom to ((ASCII character 239) & (ASCII character 187) & (ASCII
When written as UTF-8 they become a BOM.
However, now that I am writing my ShellScript I am using BBEdit and if I try
to do she same trick I have to use MacRoman Encoding for the script,
something I really like to avoid. I would prefer UTF-8 encoding, but if I
switch to UTF-8 encoding it no longer works.
Can someone help me with a shell UTF-8 way of creating the BOM?
Thanks in advance
_______________________________________________
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