158f0484fSRodney W. Grimes.\" Copyright (c) 1993 258f0484fSRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 358f0484fSRodney W. Grimes.\" 458f0484fSRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 558f0484fSRodney W. Grimes.\" Paul Borman at Krystal Technologies. 658f0484fSRodney W. Grimes.\" 758f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 858f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions 958f0484fSRodney W. Grimes.\" are met: 1058f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 1158f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 1258f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 1358f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 1458f0484fSRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 15fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 1658f0484fSRodney W. Grimes.\" may be used to endorse or promote products derived from this software 1758f0484fSRodney W. Grimes.\" without specific prior written permission. 1858f0484fSRodney W. Grimes.\" 1958f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2058f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2158f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2258f0484fSRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2358f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2458f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2558f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2658f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2758f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2858f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2958f0484fSRodney W. Grimes.\" SUCH DAMAGE. 3058f0484fSRodney W. Grimes.\" 31*b3f9b738SBaptiste Daroussin.Dd September 9, 2019 32ee0694adSTim J. Robbins.Dt EUC 5 3358f0484fSRodney W. Grimes.Os 3458f0484fSRodney W. Grimes.Sh NAME 3578b0b234SMike Pritchard.Nm euc 36c2f93303STim J. Robbins.Nd EUC encoding of wide characters 3758f0484fSRodney W. Grimes.Sh SYNOPSIS 386a145130SMike Pritchard.Nm ENCODING 396a145130SMike Pritchard.Qq EUC 406a145130SMike Pritchard.Pp 416a145130SMike Pritchard.Nm VARIABLE 426a145130SMike Pritchard.Ar len1 436a145130SMike Pritchard.Ar mask1 446a145130SMike Pritchard.Ar len2 456a145130SMike Pritchard.Ar mask2 466a145130SMike Pritchard.Ar len3 476a145130SMike Pritchard.Ar mask3 486a145130SMike Pritchard.Ar len4 496a145130SMike Pritchard.Ar mask4 506a145130SMike Pritchard.Ar mask 5158f0484fSRodney W. Grimes.Sh DESCRIPTION 52c2f93303STim J. Robbins.\"The 53c2f93303STim J. Robbins.\".Nm EUC 54c2f93303STim J. Robbins.\"encoding is provided for compatibility with 55c2f93303STim J. Robbins.\".Ux 56c2f93303STim J. Robbins.\"based systems. 57c2f93303STim J. Robbins.\"See 58*b3f9b738SBaptiste Daroussin.\".Xr localedef 1 59c2f93303STim J. Robbins.\"for a complete description of the 60c2f93303STim J. Robbins.\".Ev LC_CTYPE 61c2f93303STim J. Robbins.\"source file format. 62c2f93303STim J. Robbins.\".Pp 6358f0484fSRodney W. Grimes.Nm EUC 6458f0484fSRodney W. Grimesimplements a system of 4 multibyte codesets. 6558f0484fSRodney W. GrimesA multibyte character in the first codeset consists of 6658f0484fSRodney W. Grimes.Ar len1 6758f0484fSRodney W. Grimesbytes starting with a byte in the range of 0x00 to 0x7f. 68b9384efcSRuslan ErmilovTo allow use of 69b9384efcSRuslan Ermilov.Tn ASCII , 7058f0484fSRodney W. Grimes.Ar len1 7158f0484fSRodney W. Grimesis always 1. 7258f0484fSRodney W. GrimesA multibyte character in the second codeset consists of 7358f0484fSRodney W. Grimes.Ar len2 7458f0484fSRodney W. Grimesbytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f. 7558f0484fSRodney W. GrimesA multibyte character in the third codeset consists of 7658f0484fSRodney W. Grimes.Ar len3 7758f0484fSRodney W. Grimesbytes starting with the byte 0x8e. 7858f0484fSRodney W. GrimesA multibyte character in the fourth codeset consists of 7958f0484fSRodney W. Grimes.Ar len4 8058f0484fSRodney W. Grimesbytes starting with the byte 0x8f. 8158f0484fSRodney W. Grimes.Pp 8258f0484fSRodney W. GrimesThe 83b9384efcSRuslan Ermilov.Vt wchar_t 8458f0484fSRodney W. Grimesencoding of 8558f0484fSRodney W. Grimes.Nm EUC 8658f0484fSRodney W. Grimesmultibyte characters is dependent on the 8758f0484fSRodney W. Grimes.Ar len 8858f0484fSRodney W. Grimesand 8958f0484fSRodney W. Grimes.Ar mask 9058f0484fSRodney W. Grimesarguments. 9158f0484fSRodney W. GrimesFirst, the bytes are moved into a 92b9384efcSRuslan Ermilov.Vt wchar_t 9358f0484fSRodney W. Grimesas follows: 9458f0484fSRodney W. Grimes.Bd -literal 9558f0484fSRodney W. Grimesbyte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1 9658f0484fSRodney W. Grimes.Ed 97c492ccdbSMike Pritchard.Pp 9858f0484fSRodney W. GrimesThe result is then ANDed with 9958f0484fSRodney W. Grimes.Ar ~mask 10058f0484fSRodney W. Grimesand ORed with 1012ce08cb2SMike Pritchard.Ar maskN . 10258f0484fSRodney W. GrimesCodesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is 10358f0484fSRodney W. Grimesfirst removed and the 1042ce08cb2SMike Pritchard.Ar lenN 10558f0484fSRodney W. Grimesargument is reduced by 1. 106c492ccdbSMike Pritchard.Pp 107c2f93303STim J. RobbinsFor example, the 108c2f93303STim J. Robbins.Li ja_JP.eucJP 109c2f93303STim J. Robbinslocale has the following 110b9384efcSRuslan Ermilov.Va VARIABLE 11158f0484fSRodney W. Grimesline: 11258f0484fSRodney W. Grimes.Bd -literal 11358f0484fSRodney W. GrimesVARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080 11458f0484fSRodney W. Grimes.Ed 115c492ccdbSMike Pritchard.Pp 11658f0484fSRodney W. GrimesCodeset 1 consists of the values 0x0000 - 0x007f. 117c492ccdbSMike Pritchard.Pp 11858f0484fSRodney W. GrimesCodeset 2 consists of the values who have the bits 0x8080 set. 119c492ccdbSMike Pritchard.Pp 12058f0484fSRodney W. GrimesCodeset 3 consists of the values 0x0080 - 0x00ff. 121c492ccdbSMike Pritchard.Pp 12258f0484fSRodney W. GrimesCodeset 4 consists of the values 0x8000 - 0xff7f excluding the values 12358f0484fSRodney W. Grimeswhich have the 0x0080 bit set. 124c492ccdbSMike Pritchard.Pp 12558f0484fSRodney W. GrimesNotice that the global 12658f0484fSRodney W. Grimes.Ar mask 12758f0484fSRodney W. Grimesis set to 0x8080, this implies that from those 2 bits the codeset can 12858f0484fSRodney W. Grimesbe determined. 129b9384efcSRuslan Ermilov.Sh SEE ALSO 130*b3f9b738SBaptiste Daroussin.Xr localedef 1 , 13158f0484fSRodney W. Grimes.Xr setlocale 3 132