lua-users home
lua-l archive

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

Hmm, I seem to not be understanding this library. I downloaded the most
recent version, 1.1, and compiled it using default compiler settings. I
have the following code:

$ cat test.lua

require "unicode"

local s = "hello abcdéf there"

for word in unicode.utf8.gmatch(s, "%w+") do

$ lua test.lua

Incidentally, the 'unitest' file doesn't appear to work: unicode.utf8 is
nil, but the test code seems to assume that it isn't. Do I need to do
something special when I compile the library, or is the test file out of
sync with the library? Am I doing something wrong?

- David

On this day of 11/05/07 19:00, David Haley saw fit to scribe:
> Hi,
>> The mentioned postings refer to single-byte locales (e.g.
>> ISO-8859-*) which is the only thing standard Lua supports
>> out-of-the-box.
> Ah, I didn't realize that. Well, I also tried saving my source text in
> latin1, and it wasn't working either. I don't seem to have a non-utf8
> French locale installed to test, but:
>> But there's slnunicode:
> this is what I cared about anyhow.
>> [Note: this solves string matching, but UTF-8 variable names
>> in the source code would need a patched Lua core.]
> Fortunately for me, I only really care about string matching; the
> variable names were just exploring the problem based on the postings
> that I saw.
> Thanks for the pointer!
> - David