Re: Acquiring UTF-8 string length



Coder Guy wrote:
"Ulrich Eckhardt" wrote:
count of code points = 6, obtained by strlen()
Wrong. strlen() only returns the number of chars up to the first NUL char.
The number of codepoints is four, plus the terminating NUL.

Just tested: the returned length is six (6) characters.

I think you misunderstood Ulrich. He didn't mean that strlen doesn't return 6, he meant that strlen does not return the number of "code points". The number of code points in your string is 4, but strlen returns 6. IOW your statement:
count of code points = 6
is false. The correct statement is:
count of code points = 4

Again, do you want the count of code points, or do you actually want the count of glyphs? What are you doing with the number?

Tom
.