Re: Plain text library stacks - BOM needed

2015-05-01 Thread Mark Waddingham

I’ve found that when LiveCode saves the stack script file, it adds a
Byte Order Mark (BOM) to denote the file is UTF-8 encoded. If the BOM
is not present when you start using such a library stack, the engine
will treat it as being natively encoding. I have found that to be true
with both the IDE and Server engines. So if you want to create script
only stacks in an external editor make sure that the editor adds a BOM
when you save the file.


I do wonder, with hindsight, whether this was a mistake and the engine 
should just assume UTF-8 encoding (unless it encounters a UTF-16 BOM) of 
script-only text files. Given this is the default of most text editors 
these days, and the encoding the engine uses when saving script-only's 
itself it might simplify things slightly.



If you write scripts to run with LiveCode Server that start with a
shebang line, be aware that they do not work if there is a BOM
present.


Yes - the shell's processing of #! on Linux (and other platforms) 
requires #! to be the first two chars of the file.


This is why we added the ability to specify the encoding of server 
script files by adding a comment on the second line of the form:

  # encoding=utf-8

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Plain text library stacks - BOM needed

2015-04-30 Thread Peter W A Wood
On 23 Apr 2015, at 15:59, Mark Waddingham  wrote:
> 
> You can save the stack in the normal way but the only thing it will save will 
> be the stack script - the file on disk is just a UTF-8 text file.

I’ve found that when LiveCode saves the stack script file, it adds a Byte Order 
Mark (BOM) to denote the file is UTF-8 encoded. If the BOM is not present when 
you start using such a library stack, the engine will treat it as being 
natively encoding. I have found that to be true with both the IDE and Server 
engines. So if you want to create script only stacks in an external editor make 
sure that the editor adds a BOM when you save the file.

If you write scripts to run with LiveCode Server that start with a shebang 
line, be aware that they do not work if there is a BOM present.

Regards

Peter


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode