Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
1.0 KiB

  1. .TH scan_utf8 3
  2. .SH NAME
  3. scan_utf8 \- decode an unsigned integer from UTF-8 encoding
  4. .SH SYNTAX
  5. .B #include <scan.h>
  6. size_t \fBscan_utf8\fP(const char *\fIsrc\fR,size_t \fIlen\fR,uint32_t *\fIdest\fR);
  7. .SH DESCRIPTION
  8. scan_utf8 decodes an unsigned integer in UTF-8 encoding from a memory
  9. area holding binary data. It writes the decode value in \fIdest\fR and
  10. returns the number of bytes it read from \fIsrc\fR.
  11. scan_utf8 never reads more than \fIlen\fR bytes from \fIsrc\fR. If the
  12. sequence is longer than that, or the memory area contains an invalid
  13. sequence, scan_utf8 returns 0 and does not touch \fIdest\fR.
  14. The length of the longest UTF-8 sequence is 5. If the buffer is longer
  15. than that, and scan_utf8 fails, then the data was not a valid UTF-8
  16. encoded sequence.
  17. .SH NOTE
  18. fmt_utf8 and scan_utf8 implement the encoding from UTF-8, but are meant
  19. to be able to store integers, not just Unicode code points. Values
  20. above 0x10ffff are not valid UTF-8. If you are using this function to
  21. parse UTF-8, you need to reject them (see RFC 3629).
  22. .SH "SEE ALSO"
  23. fmt_utf8(3)