lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2009/5/5 Michal Kolodziejczyk <miko@wp.pl>:
> Duncan Cross wrote:
>
>> The binaries are
>> Win32-centric but I don't believe the actual source code is - if
>> anyone would like to look into making sure it works on other platforms
>> I would be grateful for that.
>
> This works great for me on linux with attached src/Makefile
>
> Regards,
> miko


Thank you, I appreciate it.

I have added a new minor update which includes the makefile and also
some minor new things:

1. icu.ustring(...) is now equivalent to icu.ustring.decode(...):
--
local U = require 'icu.ustring'
assert(U'Lua':reverse() == U'auL')
--

2. icu.ustring.unescape and icu.utf8.unescape - these are wrappers
around ICU's u_unescape function, which provides its own run-time
backslash unescaping, mainly useful for supporting \xXX and \uXXXX:
--
local U = require 'icu.ustring'
local UX = U.unescape
assert(U'Lua' == UX[[\x4c\u0075\x61]]) -- (note the use of [[...]] to avoid
                                       -- having to use double-backslashes)
--
GOTCHA #1: Embedded zeroes are not supported - the output string will
be cut off at the first one.
GOTCHA #2: If there are any invalid escapes, unescape returns an empty
string, not nil or an error.
GOTCHA #3: \ddd is *octal*, not decimal as in Lua - e.g. \064 is '4', not '@'.

-Duncan