#include <utf-8.h>

     char *
     sputu8(unsigned int c, char *buffer)

     char *
     utf8sputc(unsigned int c, char *buffer)


DESCRIPTION

     The sputu8() function of utf-8 library converts a UTC-4 (31-bit Unicode)
     integer to a sequence of one or more characters representing its UTF-8
     value, and writes the result to a buffer (character string). It appends a
     NUL at the end of the buffer, so it can be processed as a standard C
     string.

     utf8sputc() is a macro which simply gives sputu8() a name that may be
     more convenient to remember. It is defined in <utf-8.h>.

     The sputu8() function and the utf8sputc() macro take two arguments: c,
     the UTC-4 code, and buffer, a pointer to a string of characters. The
     buffer must have at least seven bytes available for writing: UTF-8 en-
     codes Unicode into 1 - 6 characters, plus we need room for the terminat-
     ing NUL.


RETURN VALUES

     sputu8() returns the pointer to the terminating NUL. This allows you to
     append the next sequence of characters without having to determine where
     the string ends after each call to sputu8().

     If buffer is NULL, sputu8() returns NULL. If c is not a valid UTC-4 code
     (i.e., its high bit is set), no conversion takes place, and sputu8() just
     returns buffer.


SEE ALSO

     libutf-8(3),  fgetu8(3),  fputu8(3),  sgetu8(3)

     F. Yergeau, UTF-8, a transformation format of Unicode and ISO 10646,
     RFC2044.

     D. Goldsmith, M. Davis, Using Unicode with MIME, RFC1641.


STANDARDS

     ISO 10646-1: 1993 (``Unicode''), RFC 2044: 1996 (``UTF-8''), ISO
     9899: 1990 (``ISO C'').


DIAGNOSTICS

     You should always compare the RETURN VALUES to buffer. If they are NULL,
     no conversion took place. Otherwise, if they are identical, c was not a
     valid UTC-8 integer. Anything else indicates successful conversion.


AUTHORS

     This manual page was written by G. Adam Stanislav <adam@whizkidtech.net>.

Man(1) output converted with man2html


[ Back to Whiz Kid Technomagic i18n tools ]