Re: Acquiring UTF-8 string length
- From: "Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx>
- Date: Wed, 04 Apr 2007 11:29:44 +0100
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
.
- References:
- Re: Acquiring UTF-8 string length
- From: Igor Tandetnik
- Re: Acquiring UTF-8 string length
- From: Coder Guy
- Re: Acquiring UTF-8 string length
- From: Ulrich Eckhardt
- Re: Acquiring UTF-8 string length
- Prev by Date: Re: Application stopped running in other computers
- Next by Date: Re: Specifying the leaf type in templates
- Previous by thread: Re: Acquiring UTF-8 string length
- Next by thread: Re: Acquiring UTF-8 string length
- Index(es):