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

Attachment: pgpbwxjwJu6KJ.pgp
Description: PGP signature

Reply via email to