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 .\" 4. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" @(#)euc.4 8.1 (Berkeley) 6/4/93
32 .\" $FreeBSD: src/lib/libc/locale/euc.5,v 1.13 2007/01/09 00:28:00 imp Exp $
39 .Nd EUC encoding of wide characters
57 .\"encoding is provided for compatibility with
62 .\"for a complete description of the
64 .\"source file format.
67 implements a system of 4 multibyte codesets.
68 A multibyte character in the first codeset consists of
70 bytes starting with a byte in the range of 0x00 to 0x7f.
75 A multibyte character in the second codeset consists of
77 bytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f.
78 A multibyte character in the third codeset consists of
80 bytes starting with the byte 0x8e.
81 A multibyte character in the fourth codeset consists of
83 bytes starting with the byte 0x8f.
89 multibyte characters is dependent on the
94 First, the bytes are moved into a
98 byte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1
101 The result is then ANDed with
105 Codesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is
106 first removed and the
108 argument is reduced by 1.
112 locale has the following
116 VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
119 Codeset 1 consists of the values 0x0000 - 0x007f.
121 Codeset 2 consists of the values who have the bits 0x8080 set.
123 Codeset 3 consists of the values 0x0080 - 0x00ff.
125 Codeset 4 consists of the values 0x8000 - 0xff7f excluding the values
126 which have the 0x0080 bit set.
128 Notice that the global
130 is set to 0x8080, this implies that from those 2 bits the codeset can