.\" Copyright (c) 1999 G. Adam Stanislav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" libutf-8 v.1 .\" .Dd April 1, 1999 .Dt SGETU8 3 .Os .Sh NAME .Nm sgetu8 .Nd utf-8 library function manual page .Sh SYNOPSIS .Fd #include .Ft unsigned int .Fn sgetu8 "unsigned int *chars" "char *string" .Ft unsigned int .Fn utf8sgetc "unsigned int *chars" "char *string" .Sh DESCRIPTION The .Fn sgetu8 function of utf-8 library reads a sequence of one or more characters from a UTF-8 formatted string, which it converts to a single UTC-4 (Unicode) value. .Pp .Fn utf8sgetc is a macro which simply gives .Fn sgetu8 a name that may be more convenient to remember. It is defined in .Aq Pa utf-8.h . .Pp The .Fn sgetu8 function and the .Fn utf8sgetc macro take two arguments: .Fa chars , a pointer to an integer for an additional return value, and .Fa string , which contains the sequence of one or more UTF-8 characters. .Pp .Sh RETURN VALUES If .Fa string is NULL, or if a premature end-of-string condition occurs, .Fn sgetu8 returns .Fa EOF . If .Fa string contains valid UTF-8 codes, .Fn sgetu8 returns the converted UTC-4 value. Otherwise, it returns .Fa UTF8INVALID , defined in .Aq Pa utf-8.h . .Pp Additionally, if .Fa chars is not NULL, .Fn sgetu8 will fill it in with the number of characters read from .Fa string . This allows you to determine where the next UTF-8 encoded character sequence starts in the string. .Sh SEE ALSO .Xr libutf-8 3 , .Xr fgetu8 3 , .Xr fputu8 3 , .Xr sputu8 3 .Rs .%A F. Yergeau .%T UTF-8, a transformation format of Unicode and ISO 10646 .%O RFC2044 .Re .Rs .%A D. Goldsmith, M. Davis .%T Using Unicode with MIME .%O RFC1641 .Re .Sh STANDARDS ISO 10646-1: 1993 (``Unicode''), RFC 2044: 1996 (``UTF-8''), .St -ansiC . .Sh DIAGNOSTICS You should always check the .Sx RETURN VALUES against .Fa EOF and .Fa UTF8INVALID . .Sh AUTHORS This manual page was written by .An G. Adam Stanislav Aq adam@whizkidtech.net . .Sh BUGS None known.