Extended Unix Code


Extended Unix Code is a multibyte character encoding system used primarily for Japanese, Korean, and simplified Chinese.
The structure of EUC is based on the ISO-2022 standard, which specifies a way to represent character sets containing a maximum of 94 characters, or 8836 characters, or 830584 characters, as sequences of 7-bit codes. Only ISO-2022 compliant character sets can have EUC forms. Up to four coded character sets can be represented with the EUC scheme.
G0 is almost always an ISO-646 compliant coded character set such as US-ASCII, or that is invoked on GL. An exception from US-ASCII is that 0x5C is often used to represent a Yen sign in EUC-JP and a won sign in EUC-KR.
To get the EUC form of an ISO-2022 character, the most significant bit of each 7-bit byte of the original codes is set ; this allows software to easily distinguish whether a particular byte in a character string belongs to the ISO-646 code or the ISO-2022 code.
The most commonly used EUC codes are variable-width encodings with a character belonging to G0 taking one byte and a character belonging to G1 represented in two bytes. The EUC-CN form of and EUC-KR are examples of such two-byte EUC codes. EUC-JP includes characters represented by up to three bytes whereas a single character in EUC-TW can take up to four bytes.
Modern applications are more likely to use UTF-8, which supports all of the glyphs of the EUC codes, and more, and is generally more portable with fewer vendor deviations and errors. EUC is however still very popular, especially EUC-KR for South Korea.

EUC-CN

EUC-CN is the usual encoded form of the standard for simplified Chinese characters. Unlike the case of Japanese JIS X 0208 and ISO-2022-JP, is not normally used in a 7-bit code version, although a variant form called HZ was sometimes used on USENET.
An ASCII character is represented in its usual encoding. A character from is represented by two bytes, both from the range 0xA1–0xFE.

Related encoding systems

748 code

An encoding related to EUC-CN is the "748" code used in the WITS typesetting system developed by Beijing's Founder Technology. The 748 code contains all of, but is not -compliant and therefore not a true EUC code. The non-GB2312 portion of the 748 code contains traditional and Hong Kong characters and other glyphs used in newspaper typesetting.

GBK and GB 18030

is an extension to. It defines an extended form of the EUC-CN encoding capable of representing a larger array of CJK characters sourced largely from, including traditional Chinese characters and characters used only in Japanese. It is not, however, a true EUC code, because ASCII bytes may appear as trail bytes, due to a larger encoding space being required.
Variants of GBK are implemented by Windows code page 936, and by IBM's code page 1386.
The Unicode-based character encoding defines an extension of GBK capable of encoding the entirety of Unicode. However, Unicode encoded as is a variable-width encoding which may use up to four bytes per character, due to an even larger encoding space being required. Being an extension of GBK, it is a superset of EUC-CN but is not itself a true EUC code. Being a Unicode encoding, its repertoire is identical to that of other Unicode transformation formats such as UTF-8.

Mac OS Chinese Simplified

Other EUC-CN variants deviating from the EUC mechanism include the Mac OS Chinese Simplified script. It uses the bytes 0x80, 0x81, 0x82, 0xA0, 0xFD, 0xFE and 0xFF for the U with umlaut, two special font metric characters, the non-breaking space, the copyright sign, the trademark sign and the ellipsis respectively. This differs in what is regarded as a single-byte character versus the first byte of a two-byte character from both EUC and GBK.
This use of 0xA0, 0xFD, 0xFE and 0xFF matches Apple's Shift_JIS variant.

EUC-JP

EUC-JP is a variable-width encoding used to represent the elements of three Japanese character set standards, namely,, and. Other names for this encoding include Unixized JIS and AT&T JIS. 0.1% of all web pages use EUC-JP since August 2018, while 3.2% of Japanese web sites use this encoding. It is called Code page 954 by IBM. Microsoft has two code page numbers for this encoding.
This encoding scheme allows the easy mixing of 7-bit ASCII and 8-bit Japanese without the need for the escape characters employed by ISO-2022-JP, which is based on the same character set standards, and without ASCII bytes appearing as trail bytes.
A related and partially compatible encoding, called EUC-JISx0213 or EUC-JIS-2004, encodes and .
Compared to EUC-CN or EUC-KR, EUC-JP did not become as widely adopted on PC and Macintosh systems in Japan, which used or its extensions, although it became heavily used by Unix or Unix-like operating systems. Therefore, whether Japanese web sites use EUC-JP or Shift_JIS often depends on what OS the author uses.
Vendor extensions to EUC-JP were usually allocated within the individual code sets, as opposed to using invalid EUC sequences.
Characters are encoded as follows:

EUC-KR

EUC-KR is a variable-width encoding to represent Korean text using two coded character sets, and either or US-ASCII, depending on variant. stipulates the encoding and dubbed it as EUC-KR.
A character drawn from KS X 1001 is encoded as two bytes in GR and a character from or US-ASCII takes one byte in GL.
When used with ASCII, it is called Code page 970 by IBM. It is known as Code page 51949 by Microsoft. It is usually referred to as Wansung in the Republic of Korea.
A common extension of EUC-KR is the Unified Hangul Code, which is the default Korean codepage on Microsoft Windows. The W3C/WHATWG Encoding Standard used by HTML5 incorporates the Unified Hangul Code extensions into its definition of EUC-KR. Other EUC-KR compatible extensions include the Mac OS Korean encoding, used by the classic Mac OS. IBM's code page 949 is yet another, unrelated, EUC-KR extension. Similarly to the EUC-CN extensions described above, these extensions do not conform to the EUC structure.
, 0.1% of all web pages globally use EUC-KR, which is misleading as 17.4% of South Korean web pages use, making it the most popular non-UTF-8/Unicode encoding for a language/web domain, while only 8.4% of web pages using Korean language . Including extensions, it is the most widely used legacy character encoding in Korea on all three major platforms, but its use has been very slowly shifting to UTF-8 as it gains popularity, especially on Linux and macOS.
As with most other encodings, UTF-8 is now preferred for new use, solving problems with consistency between platforms and vendors.

EUC-TW

EUC-TW is a variable-width encoding that supports US-ASCII and 16 planes of, each of which is 94x94. It is a rarely used encoding for traditional Chinese characters as used in Taiwan. Big5 is much more common.
Note that the plane 1 of CNS 11643 is encoded twice as code set 1 and a part of code set 2.
UTF-8 is becoming more common than EUC-TW, as with most code pages.

Packed versus fixed-length form

The encodings described above are in a variable-width form referred to as the EUC packed format. This is the form usually labelled as EUC.
Internal processing may make use of a fixed-length alternative form called the EUC complete two-byte format. This represents:
Initial bytes of 0x00 and 0x80 are used in cases where the code set uses only one byte. There is also a four-byte fixed-length format. These fixed-length forms are suited to internal processing and are not usually encountered in interchange.
EUC-JP is registered with the IANA in both formats, the packed format as "EUC-JP" or "csEUCPkdFmtJapanese" and the fixed width format as "csEUCFixWidJapanese". Only the packed format is included in the WHATWG Encoding Standard used by HTML5.