[luatex] unicode.utf8.format + unicode.utf8.len?

Philipp Gesang pgesang at ix.urz.uni-heidelberg.de
Fri Nov 26 14:51:22 CET 2010


Hi Taco & the Rest of the List,

I’m sorry if this question sounds stupid, but I’m wondering for
what reason the ‘format()’ of slnunicode uses Lua’s string length
mechanism instead of ‘utf8_count()’?

···8<····························································

local utf = unicode.utf8

local hello_world = "χαῖρε, ὦ κόσμε"
io.write(string.format(">%28s < [Length: %s]\n", hello_world, #hello_world))
io.write(   utf.format(">%15s < [Length: %s]\n", hello_world, utf.len(hello_world)))

···8<····························································

Could ‘utf8.format()’ be extended to check for multibyte strings
like ‘unic_len()’ at least for ‘%s’ and act accordingly?

Thanks for your time, Philipp

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20101126/0a16586d/attachment.bin>


More information about the luatex mailing list