Re: Is it possible to add utf-8 lua source file support in lua 5.2?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Is it possible to add utf-8 lua source file support in lua 5.2?
- From: David Kolf <kolf@...>
- Date: 2010年9月28日 11:51:40 +0200
Luiz Henrique de Figueiredo schrieb:
> In Lua 5.2 you don't even have to patch the lexer: just edit lctype.c
> and say that 0xFF and 0xFE are whitespace. This of course is not the
> perfect solution, because BOM is a 2-byte entity, not a 1-byte one...
In UTF-8 the BOM is encoded as 3 bytes. I use this LPeg expression for
space including the BOM:
local Space = (g.S " \n\r\t" + g.P "239円187円191円")^0
(g is a local shortcut for the lpeg module)
-- David