euc.5 (ee0694adb9143054ea2f109ce45ca2dd83381c32) euc.5 (b9384efc1c264c63a53d8c420461ef9c0c17c2b1)
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

--- 58 unchanged lines hidden (view full) ---

67.\".Ev LC_CTYPE
68.\"source file format.
69.\".Pp
70.Nm EUC
71implements a system of 4 multibyte codesets.
72A multibyte character in the first codeset consists of
73.Ar len1
74bytes starting with a byte in the range of 0x00 to 0x7f.
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

--- 58 unchanged lines hidden (view full) ---

67.\".Ev LC_CTYPE
68.\"source file format.
69.\".Pp
70.Nm EUC
71implements a system of 4 multibyte codesets.
72A multibyte character in the first codeset consists of
73.Ar len1
74bytes starting with a byte in the range of 0x00 to 0x7f.
75To allow use of ASCII,
75To allow use of
76.Tn ASCII ,
76.Ar len1
77is always 1.
78A multibyte character in the second codeset consists of
79.Ar len2
80bytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f.
81A multibyte character in the third codeset consists of
82.Ar len3
83bytes starting with the byte 0x8e.
84A multibyte character in the fourth codeset consists of
85.Ar len4
86bytes starting with the byte 0x8f.
87.Pp
88The
77.Ar len1
78is always 1.
79A multibyte character in the second codeset consists of
80.Ar len2
81bytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f.
82A multibyte character in the third codeset consists of
83.Ar len3
84bytes starting with the byte 0x8e.
85A multibyte character in the fourth codeset consists of
86.Ar len4
87bytes starting with the byte 0x8f.
88.Pp
89The
89.Va wchar_t
90.Vt wchar_t
90encoding of
91.Nm EUC
92multibyte characters is dependent on the
93.Ar len
94and
95.Ar mask
96arguments.
97First, the bytes are moved into a
91encoding of
92.Nm EUC
93multibyte characters is dependent on the
94.Ar len
95and
96.Ar mask
97arguments.
98First, the bytes are moved into a
98.Va wchar_t
99.Vt wchar_t
99as follows:
100.Bd -literal
101byte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1
102.Ed
103.Pp
104The result is then ANDed with
105.Ar ~mask
106and ORed with
107.Ar maskN .
108Codesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is
109first removed and the
110.Ar lenN
111argument is reduced by 1.
112.Pp
113For example, the
114.Li ja_JP.eucJP
115locale has the following
100as follows:
101.Bd -literal
102byte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1
103.Ed
104.Pp
105The result is then ANDed with
106.Ar ~mask
107and ORed with
108.Ar maskN .
109Codesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is
110first removed and the
111.Ar lenN
112argument is reduced by 1.
113.Pp
114For example, the
115.Li ja_JP.eucJP
116locale has the following
116.Ev VARIABLE
117.Va VARIABLE
117line:
118.Bd -literal
119VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
120.Ed
121.Pp
122Codeset 1 consists of the values 0x0000 - 0x007f.
123.Pp
124Codeset 2 consists of the values who have the bits 0x8080 set.
125.Pp
126Codeset 3 consists of the values 0x0080 - 0x00ff.
127.Pp
128Codeset 4 consists of the values 0x8000 - 0xff7f excluding the values
129which have the 0x0080 bit set.
130.Pp
131Notice that the global
132.Ar mask
133is set to 0x8080, this implies that from those 2 bits the codeset can
134be determined.
118line:
119.Bd -literal
120VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
121.Ed
122.Pp
123Codeset 1 consists of the values 0x0000 - 0x007f.
124.Pp
125Codeset 2 consists of the values who have the bits 0x8080 set.
126.Pp
127Codeset 3 consists of the values 0x0080 - 0x00ff.
128.Pp
129Codeset 4 consists of the values 0x8000 - 0xff7f excluding the values
130which have the 0x0080 bit set.
131.Pp
132Notice that the global
133.Ar mask
134is set to 0x8080, this implies that from those 2 bits the codeset can
135be determined.
135.Sh "SEE ALSO"
136.Sh SEE ALSO
136.Xr mklocale 1 ,
137.Xr setlocale 3
137.Xr mklocale 1 ,
138.Xr setlocale 3