[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua interpreter and Lua files encoding
- From: Dirk Laurie <dpl@...>
- Date: Thu, 6 Jan 2011 13:49:19 +0200
On Thu, Jan 06, 2011 at 01:15:33PM +0200, Peter Odding wrote:
> the Lua 5.1 reference manual seems to make no guarantees about
> whether the lexer and parser preserve literal UTF-8 sequences
> in string literals?
They do, whether guaranteed or not.
Lua 5.2.0 (alpha) Copyright (C) 1994-2010 Lua.org, PUC-Rio
> b={}; for j=0,255 do b[j+1]=string.char(j) end; c=table.concat(b)
> f=io.open('allbytes','w')
> f:write('all=[['..c..']]; for i=1,#all do print(string.byte(all,i)) end')
> f:close()
> dofile('allbytes') -- prints out 0 to 255
Whether you put the bytes in with a Lua program (as here) or by a text
editor using a keyboard that accepts all sorts of Compose-key sequences
does not matter. Once those bytes are inside an adequate pair of
delimiters they're just bytes.
Maybe the authors of the reference manual meant "8-bit clean" to imply
this.
Dirk