]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/locale/euc.5
This commit was generated by cvs2svn to compensate for changes in r162852,
[FreeBSD/FreeBSD.git] / lib / libc / locale / euc.5
1 .\" Copyright (c) 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Paul Borman at Krystal Technologies.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)euc.4       8.1 (Berkeley) 6/4/93
36 .\" $FreeBSD$
37 .\"
38 .Dd November 8, 2003
39 .Dt EUC 5
40 .Os
41 .Sh NAME
42 .Nm euc
43 .Nd EUC encoding of wide characters
44 .Sh SYNOPSIS
45 .Nm ENCODING
46 .Qq EUC
47 .Pp
48 .Nm VARIABLE
49 .Ar len1
50 .Ar mask1
51 .Ar len2
52 .Ar mask2
53 .Ar len3
54 .Ar mask3
55 .Ar len4
56 .Ar mask4
57 .Ar mask
58 .Sh DESCRIPTION
59 .\"The
60 .\".Nm EUC
61 .\"encoding is provided for compatibility with
62 .\".Ux
63 .\"based systems.
64 .\"See
65 .\".Xr mklocale 1
66 .\"for a complete description of the
67 .\".Ev LC_CTYPE
68 .\"source file format.
69 .\".Pp
70 .Nm EUC
71 implements a system of 4 multibyte codesets.
72 A multibyte character in the first codeset consists of
73 .Ar len1
74 bytes starting with a byte in the range of 0x00 to 0x7f.
75 To allow use of
76 .Tn ASCII ,
77 .Ar len1
78 is always 1.
79 A multibyte character in the second codeset consists of
80 .Ar len2
81 bytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f.
82 A multibyte character in the third codeset consists of
83 .Ar len3
84 bytes starting with the byte 0x8e.
85 A multibyte character in the fourth codeset consists of
86 .Ar len4
87 bytes starting with the byte 0x8f.
88 .Pp
89 The
90 .Vt wchar_t
91 encoding of
92 .Nm EUC
93 multibyte characters is dependent on the
94 .Ar len
95 and
96 .Ar mask
97 arguments.
98 First, the bytes are moved into a
99 .Vt wchar_t
100 as follows:
101 .Bd -literal
102 byte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1
103 .Ed
104 .Pp
105 The result is then ANDed with
106 .Ar ~mask
107 and ORed with
108 .Ar maskN .
109 Codesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is
110 first removed and the
111 .Ar lenN
112 argument is reduced by 1.
113 .Pp
114 For example, the
115 .Li ja_JP.eucJP
116 locale has the following
117 .Va VARIABLE
118 line:
119 .Bd -literal
120 VARIABLE        1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
121 .Ed
122 .Pp
123 Codeset 1 consists of the values 0x0000 - 0x007f.
124 .Pp
125 Codeset 2 consists of the values who have the bits 0x8080 set.
126 .Pp
127 Codeset 3 consists of the values 0x0080 - 0x00ff.
128 .Pp
129 Codeset 4 consists of the values 0x8000 - 0xff7f excluding the values
130 which have the 0x0080 bit set.
131 .Pp
132 Notice that the global
133 .Ar mask
134 is set to 0x8080, this implies that from those 2 bits the codeset can
135 be determined.
136 .Sh SEE ALSO
137 .Xr mklocale 1 ,
138 .Xr setlocale 3