2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Paul Borman at Krystal Technologies.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
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.
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
35 .\" @(#)euc.4 8.1 (Berkeley) 6/4/93
36 .\" $FreeBSD: src/lib/libc/locale/euc.5,v 1.12 2004/07/05 06:36:36 ru Exp $
43 .Nd EUC encoding of wide characters
61 .\"encoding is provided for compatibility with
66 .\"for a complete description of the
68 .\"source file format.
71 implements a system of 4 multibyte codesets.
72 A multibyte character in the first codeset consists of
74 bytes starting with a byte in the range of 0x00 to 0x7f.
79 A multibyte character in the second codeset consists of
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
84 bytes starting with the byte 0x8e.
85 A multibyte character in the fourth codeset consists of
87 bytes starting with the byte 0x8f.
93 multibyte characters is dependent on the
98 First, the bytes are moved into a
102 byte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1
105 The result is then ANDed with
109 Codesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is
110 first removed and the
112 argument is reduced by 1.
116 locale has the following
120 VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
123 Codeset 1 consists of the values 0x0000 - 0x007f.
125 Codeset 2 consists of the values who have the bits 0x8080 set.
127 Codeset 3 consists of the values 0x0080 - 0x00ff.
129 Codeset 4 consists of the values 0x8000 - 0xff7f excluding the values
130 which have the 0x0080 bit set.
132 Notice that the global
134 is set to 0x8080, this implies that from those 2 bits the codeset can