Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8len.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8len.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8len.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8len.html on line 8
Count the bytes in a UTF-8 character
#include <utf8.h>
int utf8len( const char *s,
size_t n );
- s
- A pointer to a UTF-8 character.
- n
- The maximum number of bytes to count.
ph
The utf8str() function counts the number of bytes in the UTF-8
character pointed to by s, to a maximum of n bytes, if
n is nonzero.
This function is similar to
mblen(),
except that:
- utf8str() isn't affected by the current locale.
- The s argument isn't allowed to be NULL.
- You can pass 0 for n if you know that s points to
a null-terminated string (i.e. 0 is equivalent to, but more efficient than,
strlen(s)).
- utf8str() returns -1 if s points to an invalid byte
sequence.
If n is nonzero and the n bytes pointed to by
s look like an incomplete but potentially valid character, the
function returns the negative total length of that (complete)
character (this is in the range from -2 to -UTF8_LEN_MAX).
- 0
- s points to the null character.
- > 0
- The number of bytes that comprise the multibyte character (if
the next n or fewer bytes form a valid multibyte character).
- -1
- The n-byte sequence that s points to isn't a valid
(beginning of a) UTF-8-encoded character.
- Other negative value
- The n bytes pointed to by s could be the initial
bytes of a valid UTF-8 sequence.
Photon
Safety: | |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
utf8strblen(),
utf8strlen(),
utf8strnlen()
Unicode Multilingual Support
in the Photon Programmer's Guide
mblen()
in the QNX Neutrino Library Reference
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8len.html on line 166
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8len.html on line 166