Logo Search packages:      
Sourcecode: fuse-umfuse-fat version File versions  Download package

int unicode_utf8_len ( char  lead_byte  ) 

Gets the length of a UTF-8 character.

Parameters:
lead_byte the first byte of a UTF-8 character;
Return values:
>0 the length in bytes of the UTF-8 character;
-EILSEQ invalid UTF-8 lead byte;
Remarks:
For performance reasons, this function does not parse the whole UTF-8 byte sequence, just the first byte. If checking the validity of the whole UTF-8 byte sequence is needed, use unicode_utf8_to_wchar().

Definition at line 45 of file utf8.c.

{
      int k;
      for (k = 0; k < 4; k++)
            if ((lead_byte & t[k].mask) == t[k].val)
                  return k + 1;
      return -EILSEQ;
}


Generated by  Doxygen 1.6.0   Back to index