Charles.Forsyth20060303-partialeea662d19 years agoHistory
150 lines · 2.2 KB · Text
RawDownload
.TH RUNE 10.2.SH NAMErunetochar, chartorune, runelen, fullrune, utflen, utfrune, utfrrune, utfutf \- rune/UTF conversion.SH SYNOPSIS.ta \w'\fLchar*xx'u.PP.Bint	runetochar(char *s, Rune *r).PP.Bint	chartorune(Rune *r, char *s).PP.Bint	runelen(long r).PP.Bint	fullrune(char *s, int n).PP.Bint	utflen(char *s).PP.Bchar*	utfrune(char *s, long c).PP.Bchar*	utfrrune(char *s, long c).PP.Bchar*	utfutf(char *s1, char *s2).SH DESCRIPTIONThese routines convert to and from a.SM UTFbyte stream and runes..PP.I Runetocharcopies one rune at.I rto at most.B UTFmaxbytes starting at.I sand returns the number of bytes copied..BR UTFmax ,defined as.B 3in.BR <libc.h> ,is the maximum number of bytes required to represent a rune..PP.I Chartorunecopies at most.B UTFmaxbytes starting at.I sto one rune at.I rand returns the number of bytes copied.If the input is not exactly in.SM UTFformat,.I chartorunewill convert to 0x80 and return 1..PP.I Runelenreturns the number of bytesrequired to convert.I rinto.SM UTF..PP.I Fullrunereturns 1 if the string.I sof length.I nis long enough to be decoded by.I chartoruneand 0 otherwise.This does not guarantee that the stringcontains a legal.SM UTFencoding.This routine is used by programs thatobtain input a byte ata time and need to know when a full runehas arrived..PPThe following routines are analogous to thecorresponding string routines with.B utfsubstituted for.B strand.B runesubstituted for.BR chr ..PP.I Utflenreturns the number of runes thatare represented by the.SM UTFstring.IR s ..PP.I Utfrune.RI ( utfrrune )returns a pointer to the first (last)occurrence of rune.I cin the.SM UTFstring.IR s ,or 0 if.I cdoes not occur in the string.The NUL byte terminating a string is considered tobe part of the string.IR s ..PP.I Utfutfreturns a pointer to the first occurrence ofthe.SM UTFstring.I s2as a.SM UTFsubstring of.IR s1 ,or 0 if there is none.If.I s2is the null string,.I utfutfreturns.IR s1 ..SH SOURCE.B /libkern/rune.c.br.B /libkern/runestrlen.c.br.B /libkern/utflen.c.br.B /libkern/utfrrune.c.br.B /libkern/utfrune.c.SH SEE ALSO.IR convcs (2),.IR utf (6)