[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: slnunicode format %NNs seems to be not unicode-aware
- From: Alexander Gladysh <agladysh@...>
- Date: Sat, 14 Sep 2013 14:49:55 +0400
Hi, list!
$ lua -l unicode
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> =unicode.utf8.format("|%5s|", "12345")
|12345|
> return unicode.utf8.format("|%5s|", "12")
| 12|
> return unicode.utf8.format("|%5s|", "абвгд")
|абвгд|
> return unicode.utf8.format("|%5s|", "абв")
|абв|
> return unicode.utf8.format("|%5s|", "аб")
| аб|
It seems that length in bytes is used instead of length in characters.
Judging from the code here, string is simply formatted using
non-unicode-aware s[n]printf:
https://github.com/LuaDist/slnunicode/blob/master/slnunico.c#L1227
Is there some place better than the Lua ML where I can report this
problem so it can be fixed? :-)
Best,
Alexander.