xref: /freebsd/lib/libkiconv/kiconv.3 (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
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.Dd July 17, 2003
27.Dt KICONV 3
28.Os
29.Sh NAME
30.Nm kiconv_add_xlat16_cspair ,
31.Nm kiconv_add_xlat16_cspairs ,
32.Nm kiconv_add_xlat16_table
33.Nd kernel side iconv library
34.Sh LIBRARY
35.Lb libkiconv
36.Sh SYNOPSIS
37.In sys/iconv.h
38.Ft int
39.Fo kiconv_add_xlat16_cspair
40.Fa "const char *tocode"
41.Fa "const char *fromcode"
42.Fa "int flag"
43.Fc
44.Ft int
45.Fo kiconv_add_xlat16_cspairs
46.Fa "const char *foreigncode"
47.Fa "const char *localcode"
48.Fc
49.Ft int
50.Fo kiconv_add_xlat16_table
51.Fa "const char *tocode"
52.Fa "const char *fromcode"
53.Fa "const void *data"
54.Fa "int datalen"
55.Fc
56.Sh DESCRIPTION
57The
58.Nm kiconv
59library provides multi-byte character conversion tables for kernel side
60iconv service.
61.Pp
62The
63.Fn kiconv_add_xlat16_cspair
64function
65defines a conversion table using
66.Xr iconv 3
67between
68.Fa fromcode
69charset and
70.Fa tocode
71charset.
72You can specify
73.Fa flag
74to determine if
75.Xr tolower 3
76/
77.Xr toupper 3
78conversion is included in the table.
79The
80.Fa flag
81has following values.
82.Pp
83.Bl -tag -width ".Dv KICONV_FROM_LOWER" -compact
84.It Dv KICONV_LOWER
85.It Dv KICONV_FROM_LOWER
86It generates a tolower table in addition to a character conversion table.
87The difference between two is tolower
88.Fa tocode
89or tolower
90.Fa fromcode .
91.It Dv KICONV_UPPER
92.It Dv KICONV_FROM_UPPER
93It generates a toupper table in addition to a character conversion table.
94The difference between two is toupper
95.Fa tocode
96or toupper
97.Fa fromcode .
98.El
99.Pp
100A tolower/toupper conversion is limited to single-byte characters.
101.Pp
102The
103.Fn kiconv_add_xlat16_cspairs
104function
105defines two conversion tables which are from
106.Fa localcode
107to
108.Fa foreigncode
109and from
110.Fa foreigncode
111to
112.Fa localcode .
113These conversion tables also contain both tolower and toupper tables.
114.Pp
115The
116.Fn kiconv_add_xlat16_table
117function
118defines a conversion table directly pointed by
119.Fa data
120whose length is
121.Fa datalen ,
122not using
123.Xr iconv 3 .
124.Sh SEE ALSO
125.Xr iconv 3 ,
126.Xr tolower 3 ,
127.Xr toupper 3
128