[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Accented characters: setting locale doesn't work
- From: David Haley <dchaley@...>
- Date: Mon, 05 Nov 2007 22:48:17 -0800
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
------------------------------------------------
print(os.setlocale("fr_FR.utf8"))
require "unicode"
local s = "hello abcdéf there"
for word in unicode.utf8.gmatch(s, "%w+") do
print(word)
end
------------------------------------------------
$ lua test.lua
fr_FR.utf8
hello
abcd
f
there
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?
Thanks,
- 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: http://luaforge.net/projects/sln/
>
> 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
>
--
~David-Haley
http://david.the-haleys.org