xref: /csrg-svn/lib/libc/locale/euc.4 (revision 61139)
1*61139Sbostic.\" Copyright (c) 1993
2*61139Sbostic.\"	The Regents of the University of California.  All rights reserved.
361074Sbostic.\"
461074Sbostic.\" This code is derived from software contributed to Berkeley by
561074Sbostic.\" Paul Borman at Krystal Technologies.
661074Sbostic.\"
761074Sbostic.\" %sccs.include.redist.roff%
861074Sbostic.\"
9*61139Sbostic.\"	@(#)euc.4	8.1 (Berkeley) 06/04/93
1061074Sbostic.\"
1161074Sbostic.Dd ""
1261074Sbostic.Dt EUC 4
1361074Sbostic.Os
1461074Sbostic.Sh NAME
1561074Sbostic.Nm EUC
1661074Sbostic.Nd EUC encoding of runes
1761074Sbostic.Sh SYNOPSIS
1861074Sbostic\fBENCODING "EUC"\fP
1961074Sbostic.br
2061074Sbostic\fBVARIABLE \fP\fIlen1 mask1 len2 mask2 len3 mask3 len4 mask4 mask\fP
2161074Sbostic.Sh DESCRIPTION
2261074SbosticThe
2361074Sbostic.Nm EUC
2461074Sbosticencoding is provided for compatibility with
2561074Sbostic.Ux
2661074Sbosticbased systems.
2761074SbosticSee
2861074Sbostic.Xr mklocale 1
2961074Sbosticfor a complete description of the
3061074Sbostic.Ev LC_CTYPE
3161074Sbosticsource file format.
3261074Sbostic.Pp
3361074Sbostic.Nm EUC
3461074Sbosticimplements a system of 4 multibyte codesets.
3561074SbosticA multibyte character in the first codeset consists of
3661074Sbostic.Ar len1
3761074Sbosticbytes starting with a byte in the range of 0x00 to 0x7f.
3861074SbosticTo allow use of ASCII,
3961074Sbostic.Ar len1
4061074Sbosticis always 1.
4161074SbosticA multibyte character in the second codeset consists of
4261074Sbostic.Ar len2
4361074Sbosticbytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f.
4461074SbosticA multibyte character in the third codeset consists of
4561074Sbostic.Ar len3
4661074Sbosticbytes starting with the byte 0x8e.
4761074SbosticA multibyte character in the fourth codeset consists of
4861074Sbostic.Ar len4
4961074Sbosticbytes starting with the byte 0x8f.
5061074Sbostic.Pp
5161074SbosticThe
5261074Sbostic.Ev rune_t
5361074Sbosticencoding of
5461074Sbostic.Nm EUC
5561074Sbosticmultibyte characters is dependent on the
5661074Sbostic.Ar len
5761074Sbosticand
5861074Sbostic.Ar mask
5961074Sbosticarguments.
6061074SbosticFirst, the bytes are moved into a
6161074Sbostic.Ev rune_t
6261074Sbosticas follows:
6361074Sbostic.Bd -literal
6461074Sbosticbyte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1
6561074Sbostic.Ed
6661074Sbostic.sp
6761074SbosticThe result is then ANDed with
6861074Sbostic.Ar ~mask
6961074Sbosticand ORed with
7061074Sbostic.Ar mask\fPN.
7161074SbosticCodesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is
7261074Sbosticfirst removed and the
7361074Sbostic.Ar len\fPN
7461074Sbosticargument is reduced by 1.
7561074Sbostic.sp
7661074SbosticFor example, the Japanese locale has the following
7761074Sbostic.Ev VARIABLE
7861074Sbosticline:
7961074Sbostic.Bd -literal
8061074SbosticVARIABLE	1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
8161074Sbostic.Ed
8261074Sbostic.sp
8361074SbosticCodeset 1 consists of the values 0x0000 - 0x007f.
8461074Sbostic.sp
8561074SbosticCodeset 2 consists of the values who have the bits 0x8080 set.
8661074Sbostic.sp
8761074SbosticCodeset 3 consists of the values 0x0080 - 0x00ff.
8861074Sbostic.sp
8961074SbosticCodeset 4 consists of the values 0x8000 - 0xff7f excluding the values
9061074Sbosticwhich have the 0x0080 bit set.
9161074Sbostic.sp
9261074SbosticNotice that the global
9361074Sbostic.Ar mask
9461074Sbosticis set to 0x8080, this implies that from those 2 bits the codeset can
9561074Sbosticbe determined.
9661074Sbostic.Sh "EXAMPLE - Japanese Locale"
9761074SbosticThis is a complete example of an
9861074Sbostic.Ev LC_CTYPE
9961074Sbosticsource file for the Japanese locale
10061074Sbostic.Bd -literal
10161074Sbostic/*
10261074Sbostic * Japanese LOCALE_CTYPE definitions using EUC of JIS character sets
10361074Sbostic */
10461074Sbostic
10561074SbosticENCODING	"EUC"
10661074Sbostic
10761074Sbostic/*		JIS	 JIS	  JIS			*/
10861074Sbostic/*		X201	 X208	  X201 			*/
10961074Sbostic/*		00-7f		  84-fe			*/
11061074Sbostic
11161074SbosticVARIABLE	1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
11261074Sbostic
11361074Sbostic/*
11461074Sbostic * Code Set 1
11561074Sbostic */
11661074SbosticALPHA		'A' - 'Z' 'a' - 'z'
11761074SbosticCONTROL		0x00 - 0x1f 0x7f
11861074SbosticDIGIT		'0' - '9'
11961074SbosticGRAPH		0x21 - 0x7e
12061074SbosticLOWER		'a' - 'z'
12161074SbosticPUNCT		0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
12261074SbosticSPACE		0x09 - 0x0d 0x20
12361074SbosticUPPER		'A' - 'Z'
12461074SbosticXDIGIT		'a' - 'f' 'A' - 'F'
12561074SbosticBLANK		' ' '\t'
12661074SbosticPRINT		0x20 - 0x7e
12761074Sbostic
12861074SbosticMAPLOWER	< 'A' - 'Z' : 'a' > < 'a' - 'z' : 'a' >
12961074SbosticMAPUPPER	< 'A' - 'Z' : 'A' > < 'a' - 'z' : 'A' >
13061074SbosticTODIGIT		< '0' - '9' : 0 >
13161074SbosticTODIGIT		< 'A' - 'F' : 10 > < 'a' - 'f' : 10 >
13261074Sbostic
13361074Sbostic/*
13461074Sbostic * Code Set 2
13561074Sbostic */
13661074Sbostic
13761074SbosticSPACE		0xa1a1
13861074SbosticPHONOGRAM	0xa1bc
13961074SbosticSPECIAL		0xa1a2 - 0xa1fe
14061074SbosticPUNCT		0xa1a2 - 0xa1f8		/* A few too many in here... */
14161074Sbostic
14261074SbosticSPECIAL		0xa2a1 - 0xa2ae 0xa2ba - 0xa2c1 0xa2ca - 0xa2d0 0xa2dc - 0xa2ea
14361074SbosticSPECIAL		0xa2f2 - 0xa2f9 0xa2fe
14461074Sbostic
14561074SbosticDIGIT		0xa3b0 - 0xa3b9
14661074SbosticUPPER		0xa3c1 - 0xa3da				/* Romaji */
14761074SbosticLOWER		0xa3e1 - 0xa3fa				/* Romaji */
14861074SbosticMAPLOWER	< 0xa3c1 - 0xa3da : 0xa3e1 >			/* English */
14961074SbosticMAPLOWER	< 0xa3e1 - 0xa3fa : 0xa3e1 >			/* English */
15061074SbosticMAPUPPER	< 0xa3c1 - 0xa3da : 0xa3c1 >
15161074SbosticMAPUPPER	< 0xa3e1 - 0xa3fa : 0xa3c1 >
15261074Sbostic
15361074SbosticXDIGIT		0xa3c1 - 0xa3c6 0xa3e1 - 0xa3e6
15461074Sbostic
15561074SbosticTODIGIT		< 0xa3b0 - 0xa3b9 : 0 >
15661074SbosticTODIGIT		< 0xa3c1 - 0xa3c6 : 10 > < 0xa3e1 - 0xa3e6 : 10 >
15761074Sbostic
15861074SbosticPHONOGRAM	0xa4a1 - 0xa4f3
15961074SbosticPHONOGRAM	0xa5a1 - 0xa5f6
16061074Sbostic
16161074SbosticUPPER		0xa6a1 - 0xa6b8				/* Greek */
16261074SbosticLOWER		0xa6c1 - 0xa6d8				/* Greek */
16361074SbosticMAPLOWER	< 0xa6a1 - 0xa6b8 : 0xa6c1 > < 0xa6c1 - 0xa6d8 : 0xa6c1 >
16461074SbosticMAPUPPER	< 0xa6a1 - 0xa6b8 : 0xa6a1 > < 0xa6c1 - 0xa6d8 : 0xa6a1 >
16561074Sbostic
16661074SbosticUPPER		0xa7a1 - 0xa7c1				/* Cyrillic */
16761074SbosticLOWER		0xa7d1 - 0xa7f1				/* Cyrillic */
16861074SbosticMAPLOWER	< 0xa7a1 - 0xa7c1 : 0xa7d1 > < 0xa7d1 - 0xa7f1 : 0xa7d1 >
16961074SbosticMAPUPPER	< 0xa7a1 - 0xa7c1 : 0xa7a1 > < 0xa7d1 - 0xa7f1 : 0xa7a1 >
17061074Sbostic
17161074SbosticSPECIAL		0xa8a1 - 0xa8c0
17261074Sbostic
17361074SbosticIDEOGRAM	0xb0a1 - 0xb0fe 0xb1a1 - 0xb1fe 0xb2a1 - 0xb2fe
17461074SbosticIDEOGRAM	0xb3a1 - 0xb3fe 0xb4a1 - 0xb4fe 0xb5a1 - 0xb5fe
17561074SbosticIDEOGRAM	0xb6a1 - 0xb6fe 0xb7a1 - 0xb7fe 0xb8a1 - 0xb8fe
17661074SbosticIDEOGRAM	0xb9a1 - 0xb9fe 0xbaa1 - 0xbafe 0xbba1 - 0xbbfe
17761074SbosticIDEOGRAM	0xbca1 - 0xbcfe 0xbda1 - 0xbdfe 0xbea1 - 0xbefe
17861074SbosticIDEOGRAM	0xbfa1 - 0xbffe 0xc0a1 - 0xc0fe 0xc1a1 - 0xc1fe
17961074SbosticIDEOGRAM	0xc2a1 - 0xc2fe 0xc3a1 - 0xc3fe 0xc4a1 - 0xc4fe
18061074SbosticIDEOGRAM	0xc5a1 - 0xc5fe 0xc6a1 - 0xc6fe 0xc7a1 - 0xc7fe
18161074SbosticIDEOGRAM	0xc8a1 - 0xc8fe 0xc9a1 - 0xc9fe 0xcaa1 - 0xcafe
18261074SbosticIDEOGRAM	0xcba1 - 0xcbfe 0xcca1 - 0xccfe 0xcda1 - 0xcdfe
18361074SbosticIDEOGRAM	0xcea1 - 0xcefe 0xcfa1 - 0xcfd3 0xd0a1 - 0xd0fe
18461074SbosticIDEOGRAM	0xd1a1 - 0xd1fe 0xd2a1 - 0xd2fe 0xd3a1 - 0xd3fe
18561074SbosticIDEOGRAM	0xd4a1 - 0xd4fe 0xd5a1 - 0xd5fe 0xd6a1 - 0xd6fe
18661074SbosticIDEOGRAM	0xd7a1 - 0xd7fe 0xd8a1 - 0xd8fe 0xd9a1 - 0xd9fe
18761074SbosticIDEOGRAM	0xdaa1 - 0xdafe 0xdba1 - 0xdbfe 0xdca1 - 0xdcfe
18861074SbosticIDEOGRAM	0xdda1 - 0xddfe 0xdea1 - 0xdefe 0xdfa1 - 0xdffe
18961074SbosticIDEOGRAM	0xe0a1 - 0xe0fe 0xe1a1 - 0xe1fe 0xe2a1 - 0xe2fe
19061074SbosticIDEOGRAM	0xe3a1 - 0xe3fe 0xe4a1 - 0xe4fe 0xe5a1 - 0xe5fe
19161074SbosticIDEOGRAM	0xe6a1 - 0xe6fe 0xe7a1 - 0xe7fe 0xe8a1 - 0xe8fe
19261074SbosticIDEOGRAM	0xe9a1 - 0xe9fe 0xeaa1 - 0xeafe 0xeba1 - 0xebfe
19361074SbosticIDEOGRAM	0xeca1 - 0xecfe 0xeda1 - 0xedfe 0xeea1 - 0xeefe
19461074SbosticIDEOGRAM	0xefa1 - 0xeffe 0xf0a1 - 0xf0fe 0xf1a1 - 0xf1fe
19561074SbosticIDEOGRAM	0xf2a1 - 0xf2fe 0xf3a1 - 0xf3fe 0xf4a1 - 0xf4a4
19661074Sbostic/*
19761074Sbostic * This is for Code Set 3, half-width kana
19861074Sbostic */
19961074SbosticSPECIAL		0xa1 - 0xdf
20061074SbosticPHONOGRAM	0xa1 - 0xdf
20161074SbosticCONTROL		0x84 - 0x97 0x9b - 0x9f 0xe0 - 0xfe
20261074Sbostic.Ed
20361074Sbostic.Sh "SEE ALSO"
20461074Sbostic.Xr mklocale 1 ,
20561074Sbostic.Xr setlocale 3
206