Re: Writing to file as UTF8 with BOM ?
Re: Writing to file as UTF8 with BOM ?
- Subject: Re: Writing to file as UTF8 with BOM ?
- From: Sander Tekelenburg <email@hidden>
- Date: Fri, 27 Oct 2006 09:35:33 +0200
At 04:45 +0200 UTC, on 2006-10-27, Yvon Thoraval wrote:
[...]
> adding a bom is questionnable because, fundamentaly you are writing
> something to recognize the encoding in a file of unknown encoding....
I understand what you mean, but AFAIK this is in fact the best/most
interoperable option. At least at this point in time.
> in my opinion it would have been better writing that outsude of the file
> contents
Definitely. That's why, for example, a properly HTTP-served file is
accompanied by a Content-Type header that provides the character repertoire
that applies. However, not only is it all too often not or incorrectly used
on the Web, not every protocol even offers such a mechanism. (If I'm not
mistaken ftp, afp, smb are all examples of such poverty).
> in the name of the file for ex part of the extension.
File name extensions aren't appropriate for this sort of thing. How would
file name extensions allow you to differentiate between both the type and the
encoding? If you'd name the file "filename.utf8", you'd not yet know whether
it is a .txt, .html, .css .php, applescript or whatever file.
UTIs, file/creator types, content-type headers, file name extensions, none of
them are standardized enough to be interoperable across platforms. All in
all, a BOM seems to me to still be the most realistic approach.
[...]
> [...] i've an app where i have to guess encoding [of the input -st].
That sucks. Some apps can guess the encoding for you, so maybe one of the
gods in this list can even tell you how to do that from within AS (I'm sure
it will require some do shell script call). But it would still be a guess.
IMO the only way to be sure is for whoever gives you the file to tell you
what encoding applies -- assuming they even know...
--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
_______________________________________________
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