luautf8 icon indicating copy to clipboard operation
luautf8 copied to clipboard

utf8.len(str) == nil

Open johnd0e opened this issue 6 months ago • 0 comments

Many routines are the same as Lua's string module:

  • ...
  • utf8.len

In fact I see the difference when processing invalid utf8 strings:

local a = "\128\129\130"
print(utf8.len(a))
nil    1

This difference can lead to unobvious bugs.

So it must be either documented, or changed to throw error.

johnd0e avatar Aug 17 '24 15:08 johnd0e