xref: /freebsd/lib/libkiconv/kiconv.3 (revision c6989859ae9388eeb46a24fe88f9b8d07101c710)
1.\"
2.\" Copyright (c) 2003 Ryuichiro Imura
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd July 17, 2003
29.Dt KICONV 3
30.Os
31.Sh NAME
32.Nm kiconv_add_xlat16_cspair ,
33.Nm kiconv_add_xlat16_cspairs ,
34.Nm kiconv_add_xlat16_table
35.Nd kernel side iconv library
36.Sh LIBRARY
37.Lb libkiconv
38.Sh SYNOPSIS
39.In sys/iconv.h
40.Ft int
41.Fo kiconv_add_xlat16_cspair
42.Fa "const char *tocode"
43.Fa "const char *fromcode"
44.Fa "int flag"
45.Fc
46.Ft int
47.Fo kiconv_add_xlat16_cspairs
48.Fa "const char *foreigncode"
49.Fa "const char *localcode"
50.Fc
51.Ft int
52.Fo kiconv_add_xlat16_table
53.Fa "const char *tocode"
54.Fa "const char *fromcode"
55.Fa "const void *data"
56.Fa "int datalen"
57.Fc
58.Sh DESCRIPTION
59The
60.Nm kiconv
61library provides multi-byte character conversion tables for kernel side
62iconv service.
63.Pp
64The
65.Fn kiconv_add_xlat16_cspair
66function
67defines a conversion table using
68.Xr iconv 3
69between
70.Fa fromcode
71charset and
72.Fa tocode
73charset.
74You can specify
75.Fa flag
76to determine if
77.Xr tolower 3
78/
79.Xr toupper 3
80conversion is included in the table.
81The
82.Fa flag
83has following values.
84.Pp
85.Bl -tag -width ".Dv KICONV_FROM_LOWER" -compact
86.It Dv KICONV_LOWER
87.It Dv KICONV_FROM_LOWER
88It generates a tolower table in addition to a character conversion table.
89The difference between two is tolower
90.Fa tocode
91or tolower
92.Fa fromcode .
93.It Dv KICONV_UPPER
94.It Dv KICONV_FROM_UPPER
95It generates a toupper table in addition to a character conversion table.
96The difference between two is toupper
97.Fa tocode
98or toupper
99.Fa fromcode .
100.El
101.Pp
102A tolower/toupper conversion is limited to single-byte characters.
103.Pp
104The
105.Fn kiconv_add_xlat16_cspairs
106function
107defines two conversion tables which are from
108.Fa localcode
109to
110.Fa foreigncode
111and from
112.Fa foreigncode
113to
114.Fa localcode .
115These conversion tables also contain both tolower and toupper tables.
116.Pp
117The
118.Fn kiconv_add_xlat16_table
119function
120defines a conversion table directly pointed by
121.Fa data
122whose length is
123.Fa datalen ,
124not using
125.Xr iconv 3 .
126.Sh SEE ALSO
127.Xr iconv 3 ,
128.Xr tolower 3 ,
129.Xr toupper 3
130