10d5acd74SJohn Marino.\" Copyright (c) 1993 20d5acd74SJohn Marino.\" The Regents of the University of California. All rights reserved. 30d5acd74SJohn Marino.\" 40d5acd74SJohn Marino.\" This code is derived from software contributed to Berkeley by 50d5acd74SJohn Marino.\" Paul Borman at Krystal Technologies. 60d5acd74SJohn Marino.\" 70d5acd74SJohn Marino.\" Redistribution and use in source and binary forms, with or without 80d5acd74SJohn Marino.\" modification, are permitted provided that the following conditions 90d5acd74SJohn Marino.\" are met: 100d5acd74SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 110d5acd74SJohn Marino.\" notice, this list of conditions and the following disclaimer. 120d5acd74SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 130d5acd74SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 140d5acd74SJohn Marino.\" documentation and/or other materials provided with the distribution. 15*c66c7e2fSzrj.\" 3. Neither the name of the University nor the names of its contributors 160d5acd74SJohn Marino.\" may be used to endorse or promote products derived from this software 170d5acd74SJohn Marino.\" without specific prior written permission. 180d5acd74SJohn Marino.\" 190d5acd74SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 200d5acd74SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 210d5acd74SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 220d5acd74SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 230d5acd74SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 240d5acd74SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 250d5acd74SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 260d5acd74SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 270d5acd74SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 280d5acd74SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 290d5acd74SJohn Marino.\" SUCH DAMAGE. 300d5acd74SJohn Marino.\" 310d5acd74SJohn Marino.\" @(#)euc.4 8.1 (Berkeley) 6/4/93 320d5acd74SJohn Marino.\" $FreeBSD: head/lib/libc/locale/euc.5 165903 2007-01-09 00:28:16Z imp $ 330d5acd74SJohn Marino.\" 340d5acd74SJohn Marino.Dd November 8, 2003 350d5acd74SJohn Marino.Dt EUC 5 360d5acd74SJohn Marino.Os 370d5acd74SJohn Marino.Sh NAME 380d5acd74SJohn Marino.Nm euc 390d5acd74SJohn Marino.Nd EUC encoding of wide characters 400d5acd74SJohn Marino.Sh SYNOPSIS 410d5acd74SJohn Marino.Nm ENCODING 420d5acd74SJohn Marino.Qq EUC 430d5acd74SJohn Marino.Pp 440d5acd74SJohn Marino.Nm VARIABLE 450d5acd74SJohn Marino.Ar len1 460d5acd74SJohn Marino.Ar mask1 470d5acd74SJohn Marino.Ar len2 480d5acd74SJohn Marino.Ar mask2 490d5acd74SJohn Marino.Ar len3 500d5acd74SJohn Marino.Ar mask3 510d5acd74SJohn Marino.Ar len4 520d5acd74SJohn Marino.Ar mask4 530d5acd74SJohn Marino.Ar mask 540d5acd74SJohn Marino.Sh DESCRIPTION 550d5acd74SJohn Marino.\"The 560d5acd74SJohn Marino.\".Nm EUC 570d5acd74SJohn Marino.\"encoding is provided for compatibility with 580d5acd74SJohn Marino.\".Ux 590d5acd74SJohn Marino.\"based systems. 600d5acd74SJohn Marino.\"See 610d5acd74SJohn Marino.\".Xr mklocale 1 620d5acd74SJohn Marino.\"for a complete description of the 630d5acd74SJohn Marino.\".Ev LC_CTYPE 640d5acd74SJohn Marino.\"source file format. 650d5acd74SJohn Marino.\".Pp 660d5acd74SJohn Marino.Nm EUC 670d5acd74SJohn Marinoimplements a system of 4 multibyte codesets. 680d5acd74SJohn MarinoA multibyte character in the first codeset consists of 690d5acd74SJohn Marino.Ar len1 700d5acd74SJohn Marinobytes starting with a byte in the range of 0x00 to 0x7f. 710d5acd74SJohn MarinoTo allow use of 720d5acd74SJohn Marino.Tn ASCII , 730d5acd74SJohn Marino.Ar len1 740d5acd74SJohn Marinois always 1. 750d5acd74SJohn MarinoA multibyte character in the second codeset consists of 760d5acd74SJohn Marino.Ar len2 770d5acd74SJohn Marinobytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f. 780d5acd74SJohn MarinoA multibyte character in the third codeset consists of 790d5acd74SJohn Marino.Ar len3 800d5acd74SJohn Marinobytes starting with the byte 0x8e. 810d5acd74SJohn MarinoA multibyte character in the fourth codeset consists of 820d5acd74SJohn Marino.Ar len4 830d5acd74SJohn Marinobytes starting with the byte 0x8f. 840d5acd74SJohn Marino.Pp 850d5acd74SJohn MarinoThe 860d5acd74SJohn Marino.Vt wchar_t 870d5acd74SJohn Marinoencoding of 880d5acd74SJohn Marino.Nm EUC 890d5acd74SJohn Marinomultibyte characters is dependent on the 900d5acd74SJohn Marino.Ar len 910d5acd74SJohn Marinoand 920d5acd74SJohn Marino.Ar mask 930d5acd74SJohn Marinoarguments. 940d5acd74SJohn MarinoFirst, the bytes are moved into a 950d5acd74SJohn Marino.Vt wchar_t 960d5acd74SJohn Marinoas follows: 970d5acd74SJohn Marino.Bd -literal 980d5acd74SJohn Marinobyte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1 990d5acd74SJohn Marino.Ed 1000d5acd74SJohn Marino.Pp 1010d5acd74SJohn MarinoThe result is then ANDed with 1020d5acd74SJohn Marino.Ar ~mask 1030d5acd74SJohn Marinoand ORed with 1040d5acd74SJohn Marino.Ar maskN . 1050d5acd74SJohn MarinoCodesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is 1060d5acd74SJohn Marinofirst removed and the 1070d5acd74SJohn Marino.Ar lenN 1080d5acd74SJohn Marinoargument is reduced by 1. 1090d5acd74SJohn Marino.Pp 1100d5acd74SJohn MarinoFor example, the 1110d5acd74SJohn Marino.Li ja_JP.eucJP 1120d5acd74SJohn Marinolocale has the following 1130d5acd74SJohn Marino.Va VARIABLE 1140d5acd74SJohn Marinoline: 1150d5acd74SJohn Marino.Bd -literal 1160d5acd74SJohn MarinoVARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080 1170d5acd74SJohn Marino.Ed 1180d5acd74SJohn Marino.Pp 1190d5acd74SJohn MarinoCodeset 1 consists of the values 0x0000 - 0x007f. 1200d5acd74SJohn Marino.Pp 1210d5acd74SJohn MarinoCodeset 2 consists of the values who have the bits 0x8080 set. 1220d5acd74SJohn Marino.Pp 1230d5acd74SJohn MarinoCodeset 3 consists of the values 0x0080 - 0x00ff. 1240d5acd74SJohn Marino.Pp 1250d5acd74SJohn MarinoCodeset 4 consists of the values 0x8000 - 0xff7f excluding the values 1260d5acd74SJohn Marinowhich have the 0x0080 bit set. 1270d5acd74SJohn Marino.Pp 1280d5acd74SJohn MarinoNotice that the global 1290d5acd74SJohn Marino.Ar mask 1300d5acd74SJohn Marinois set to 0x8080, this implies that from those 2 bits the codeset can 1310d5acd74SJohn Marinobe determined. 1320d5acd74SJohn Marino.Sh SEE ALSO 13352633ed6SSascha Wildner.Xr localedef 1 , 1340d5acd74SJohn Marino.Xr setlocale 3 135