lua-users home
lua-l archive

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


Hi,

>> print(os.setlocale("fr_FR.utf8"))
> 
> You don't need this anymore. The libc locale is ignored because
> slnunicode has its own UTF-8 functions.

Oh; thanks. I thought I might have to tell it which code page to use.


> Entering this into an UTF-8 encoded source file, I get:
> 
> hello
> abcdéf
> there
> 
> Maybe your source file is still in ISO-8859-1 encoding?
> 
> Try: iconv -f iso-8859-1 -t utf-8 <oldfile >newfile

Hmm... how strange. My file was indeed encoded using utf-8, and yet I
don't get the accented e. What factors should I be looking for that
could affect this? What information should I provide to help diagnose?
I'm somewhat ignorant when it comes to unicode and locales... :/



> To fix this remove the 'lua_pop(L, 1);' in line 1324 and add a
> 'lua_settop(L, 2);' just before the final 'return 1;'. Now
> recompile: cc -shared -Wall -Os -fpic -o unicode.so slnunico.c
> And try the test cases: lua unitest

That fixed it, thanks.

I noticed that you weren't including the compiled object for slnudata.c
 in the .so; I tried doing that as well and it gave the same results for
the above gmatch test.


Interestingly, when I do the following:

local s2 = "abcdéf"
print(unicode.utf8.find(s2, "%a*"))

I get 1,7 as expected. (7, not 6, I presume because the accented
character is actually 2 bytes.)
So it looks like find is working, but gmatch isn't, although it seems
that gmatch is working on your end.

Thanks for your help,
- David

-- 
~David-Haley
http://david.the-haleys.org