UTF-8/ko

UTF-8은 가변 길이 문자 인코딩이며, 심볼당 1바이트에서 4바이트를 사용합니다. 따라서 첫번째 UTF-8 바이트는 ASCII에 대한 이전 호환성을 완전히 갖춘 문자 세트를 제공하는 ASCII 인코딩 용도로 사용합니다. UTF-8은 ASCII와 라틴 문자를 데이터의 크기를 크게 변화하지 않고도 상호 표현이 가능함을 의미하는데, 첫 번째 바이트만 활용하기 때문입니다. 상위 바이트 범위를 할당 받아 만족하지 않는 일본어권 사용자 같은 동방 문자 사용자들에게는 최대 50%의 데이터 중복을 취하게 되었습니다.

What is a character encoding?
Computers themselves do not understand printed text as a human would. For computers, every character of text is represented by a number. Traditionally, each set of numbers used to represent alphabets and characters (known as a coding system, encoding, or character set) was limited in size due to limitations in computer hardware.

The history of character encodings
The most common (or at least the most widely accepted) character set is ASCII (American Standard Code for Information Interchange). It is widely held that ASCII is the most successful software standard ever created. Modern ASCII was standardized in 1986 (ANSI X3.4, RFC 20, ISO/IEC 646:1991, ECMA-6) by the American National Standards Institute.

ASCII는 7비트로 엄격하게 제한되었으며, 표현 가능한 7개의 이진수로 비트 패턴을 사용함을 의미하는데, 10진수로는 0부터 127까지의 범위를 제공합니다. 여기에는 32개의 보이지 않는 제어 문자가 있는데, 0부터 31까지의 범위에 있으며, 마지막 제어 문자는 DEL또는 delete이며, 이 제어문자는 127번에 할당되어 있습니다. 32번 부터 126번 까지는 공백 문자, 문장 부호, 라틴 문자, 숫자와 같은 눈에 보이는 문자로 구성되어 있습니다.

The eighth bit in ASCII was originally used as a parity bit for error checking. If error checking is not desired, it is left as 0. This means that, with ASCII, each character is represented by a single byte.

Although ASCII was enough for communication in modern English, in other European languages that include accented characters, things were not so easy. The ISO 8859 standards were developed to meet these needs. They were backwards compatible with ASCII, but instead of leaving the eighth bit blank, they used it to allow another 127 characters in each encoding. ISO 8859's limitations soon came to light, and there are currently 15 variants of the ISO 8859 standard (8859-1 through to 8859-15). Outside of the ASCII-compatible byte range of these character sets, there is often conflict between the letters represented by each byte. To complicate interoperability between character encodings further, Windows-1252 is used in some versions of Microsoft Windows instead for Western European languages. This is a super-set of ISO 8859-1, however it is different in several ways; these sets do all retain ASCII compatibility.

The necessary development of completely different single-byte encodings for non-Latin alphabets, such as EUC (Extended Unix Coding) which is used for Japanese and Korean (and to a lesser extent Chinese) created more confusion. Other operating systems still used different character sets for the same languages, for example, Shift-JIS and ISO-2022-JP. Users wishing to view cyrillic glyphs had to choose between KOI8-R for Russian and Bulgarian or KOI8-U for Ukrainian, as well as all the other cyrillic encodings such as the unsuccessful ISO 8859-5, and the common Windows-1251 set. All of these character sets broke most compatibility with ASCII. Although it should be mentioned KOI8 encodings place cyrillic characters in Latin order, so in case the eighth bit is stripped, text is still decipherable on an ASCII terminal through case-reversed transliteration.

All of this has led to mass confusion, and to an almost total inability for multilingual communication; especially across different alphabets. Enter Unicode.

유니코드가 무엇인가요?
Unicode throws away the traditional single-byte limit of character sets. It uses 17 "planes" of 65,536 code points to describe a maximum of 1,114,112 characters. As the first plane, aka. "Basic Multilingual Plane" or BMP, contains almost every character a user will ever need. Many have made the wrong assumption that Unicode was a 16-bit character set.

Unicode has been mapped in many different ways, but the two most common are UTF (Unicode Transformation Format) and UCS (Universal Character Set). A number after UTF indicates the number of bits in one unit, while the number after UCS indicates the number of bytes. UTF-8 has become the most widespread means for the interchange of Unicode text as a result of its eight-bit clean nature; it is therefore the subject of this document.

What UTF-8 can do
UTF-8 allows users to work in a standards-compliant and internationally accepted multilingual environment, with a comparatively low data redundancy. It is the preferred way for transmitting non-ASCII characters over the Internet, through Email, IRC, or almost any other medium. Despite this, many people regard UTF-8 in online communication as abusive. It is always best to be aware of the attitude towards UTF-8 in a specific channel, mailing list, or Usenet group before using non-ASCII UTF-8.

Finding or creating UTF-8 locales
Now that the principles behind Unicode have been laid out, get ready to start using UTF-8 locally!

For users interested in more knowledge further explanation can be found in the Gentoo Localization Guide.

Next, the user needs to decide whether a UTF-8 locale is available for the language of choice, or whether one needs to be generated.

From the output of the above command, look for a result with a suffix similar to. If there is no result with a similar suffix a UTF-8 compatible locale must be created.

Replace "en_GB" with the desired locale setting:

Another way to include a UTF-8 locale is to add it to the file and generate necessary locales using the locale-gen command. Locales will be written to the locale-archive.

Setting the locale
There is one environment variable that needs to be set in order to use the new UTF-8 locales:  (optionally modify the   variable to change the system language as well). There are also many different ways to set it; some system administrators prefer to only have a UTF-8 environment for a specific user, in which case they set them in their (/bin/sh for Bourne shell users),  or  (/bin/bash for Bourne again shell users). More details and best practices can be found in the Localization Guide.

Still others prefer to set the locale globally. One specific circumstance where the author particularly recommends doing this is when is in use, because this init script starts the display manager and desktop before any of the aforementioned shell startup files are sourced. In other words, this is performed before any of the variables are loaded in the environment.

Setting the locale globally should be done using file. This file should look something like the following:

다음, 바뀐 내용으로 환경을 업데이트해야 합니다.

Now, run locale with no arguments to see if the correct variables have been loaded in the environment:

Alternatively, using eselect to set locales
Although it is good to maintain the system as described above, it is possible to verify the correct locale configured using the eselect utility.

Use eselect to list the available locales on the system:

Using eselect setting the locale is as simple as listing them. Once the correct locale has been determined invoke:

Check the result:

In case it is preferred to have with   instead of , run the appropriate eselect command:

Running the following command will update the variables in the shell:

That is everything. The system is now using UTF-8 locales. The next hurdle is the configuration of the applications used from day to day.

Application support
When Unicode first started gaining momentum in the software world, multibyte character sets were not well suited to languages like C, which is the base language of most commonly used programs. Even today, some programs are not able to handle UTF-8 properly. Fortunately the majority of programs, especially the common ones, are supported.

파일 이름, NTFS, FAT
There are several NLS options in the Linux kernel configuration menu, but it is important to not become confused. For the most part, the only thing that needs to be done is to build UTF-8 NLS support into the kernel, and change the default NLS option to utf8.

When planning to mount NTFS partitions, users may need to specify a  option with mount. When planning on mounting FAT partitions, users may need to specify a  option with mount. Optionally, users can also set a default codepage for FAT in the kernel configuration.

Avoid setting  to UTF-8; it is not recommended. Instead, pass the  option when mounting FAT partitions. For further information man mount</tt> or see the appropriate kernel documentation at

파일 이름 인코딩을 바꾸려면 패키지를 사용할 수 있습니다.

The format of the convmv</tt> command is as follows:

Substitute iso-8859-1 with the charset being converted from:

For changing the contents of files, use the iconv</tt> utility, it comes bundled with and should be installed on all Gentoo systems. Substitute iso-8859-1 with the charset being converted from. After running the command be sure to check for sane output:

To convert a file, another file must be created:

The recode package can also be used for this purpose.

The system console
To enable UTF-8 on the console edit Set   and read the comments -- it is important to have a font that has a good range of characters to make the most of Unicode. For this to work make sure the Unicode locale has been properly created.

에 설정한  변수에서, Unicode 키 맵을 지정해야합니다.

ncueses 와 slang
It is wise to add  to the global USE flags in, and then to re-emerge  and. Portage will do this automatically if the  or   options are used. Run the following command to pull in the packages:

이들 설정을 연결하려 꾸러미를 다시 빌드해야 하므로 이제 바꾼 USE 설정을 적용하겠습니다. 우리가 사용할 도구는 꾸러미에 있습니다.

KDE, 그놈, Xfce
모든 주요 데스크톱 환경은 완전한 유니코드 지원 기능을 제공하며, 이 안내서에서 이미 다룬 더 이상의 설정이 필요하지 않습니다. 왜냐면 근본적인 그래픽 툴-키트(Qt 또는 GTK+2)는 UTF-8을 인식하기 떄문입니다. 그 다음에는 이 툴키트 위에서 동작하는 모든 프로그램은 특별히 UTF-8을 인지해야 합니다.

On GTK+ based applications, the key sequence for hexadecimal Unicode input is Ctrl-Shift-u.

Xlib와 GTK+1 활용시 별도의 고려사항이 있습니다. GTK+1에서는 ~/.gtkrc에 iso-10646-1 FontSpec이 필요한데, 를 예로 들 수 있습니다. 또한 Xlib나 Xaw를 활용하는 프로그램은 동일한 FontSpec이 필요한데, 이 요건을 충족하지 않으면 동작하지 않습니다.

프로그램에서 Qt와 GTK+2 GUI를 지원한다면, 보통 GTK+2 GUI가 유니코드를 더 잘 지원합니다.

X11 and fonts
TrueType fonts have support for Unicode, and most of the fonts that ship with Xorg have extensive character support, although, obviously, not every single glyph available in Unicode has been created for that font.

Also, many font packages in Portage are Unicode aware. See the Fontconfig page for more information on recommended fonts and configuration.

Window managers and terminal emulators
Window managers not built on GTK+ or Qt generally have very good Unicode support, as they often use the Xft library for handling fonts. If the window manager does not use Xft for fonts, then it is still possible to use the FontSpec mentioned in the previous section as a Unicode font.

Xft를 사용하며 유니코드를 지원하는 터미널 에뮬레이터는 좀처럼 찾아보기 쉽지 않습니다. Konsole과 gnome-terminal 이외에 포티지에서 선택할 수 있는 최상의 선택지는,, , , , 또는   USE 플래그를 사용할 때 uxterm으로 실행하는  입니다.에서는   또는 에 다음 명령을 넣었을 때 UTF-8을 지원합니다:

Vim, emacs, xemacs and nano
Vim provides full UTF-8 support, and also has builtin detection of UTF-8 files. For further information in Vim, use.

GNU Emacs<sup style="color:#ff0077">en 은 버전 23부터, XEmacs<sup style="color:#ff0077">en 은 버전 21.5부터 UTF-8을 완벽하게 지원합니다. GNU Emacs 24 에서도 양방향성 텍스트 편집을 지원합니다:

nano는 1.3.6부터 UTF-8을 완벽하게 지원합니다.

쉘
Currently,  provides full Unicode support through the GNU readline library. Z Shell (zsh</tt>) offers Unicode support with the  USE flag.

The C shell, tcsh</tt> and ksh</tt> do not provide UTF-8 support at all.

Irssi
Irssi는 사용자가 옵션을 별도로 설정해야 하지만 UTF-8을 완벽하게 지원합니다.

비 UTF-8 문자 세트로 비 ASCII 문자를 자주 주고받는 채널이라면, 문자를 변환할때  명령을 사용하십시오. 더 많은 내용은 를 입력하십시오.

Mutt
The Mutt mail user agent has very good Unicode support. To use UTF-8 with Mutt, nothing needs to be put in the configuration files. Mutt will work under Unicode environment without modification if all the configuration files (signature included) are UTF-8 encoded.

더 많은 내용은 Mutt 위키<sup style="color:#ff0077">en 에 있습니다.

Man
Man pages are an integral part of any Linux machine. To ensure that any unicode in the man pages render correctly, edit and replace a line as shown below.

links and elinks
These are commonly used text-based browsers, and we shall see how we can enable UTF-8 support on them. On elinks</tt> and links</tt>, there are two ways to go about this, one using the Setup option from within the browser or editing the config file. To set the option through the browser, open a site with elinks</tt> or links</tt> and then + to enter the Setup Menu then select Terminal options, or press. Scroll down and select the last option  by pressing. Then Save and exit the menu. On links</tt> one may have to do a repeat + and then press to save. The config file option, is shown below.

Samba
삼바는 Mac, 리눅스, FreeBSD와 같은 UNIX 시스템에서 SMB(서버 메시지 블록) 프로토콜을 구현한 소프트웨어 모음입니다. 이 프로토콜은 일반 인터넷 파일 시스템(CIFS)처럼 참고하기도 합니다. 삼바에는 윈도우 네트워크 파일 공유에 사용하는 NetBIOS 시스템도 있습니다.

다음 내용을 [global] 섹션에 추가하십시오:

전체 시험하기
UTF-8을 시험해볼 수 있는 웹사이트는 여러군데에 있습니다. ,, , , 모질라 기반 브라우저(Firefox 포함)에서 UTF-8을 지원합니다. Konqueror 와 Opera도 역시 마찬가지로 UTF-8을 완벽하게 지원합니다.

When using one of the text-only web browsers, make absolutely sure a Unicode-aware terminal is used.

If certain characters are displayed as boxes with letters or numbers inside, then the current font does not have a character for the symbol or glyph that the UTF-8 wants. Instead, it displays a box with the hex code of the UTF-8 symbol.


 * unicode-table.com
 * A W3C UTF-8 Test Page
 * A UTF-8 test page provided by the University of Frankfurt

Input methods
Dead keys may be used to input characters in X that are not included on the keyboard. These work by pressing the right key (or in some countries, ) and an optional key from the non-alphabetical section of the keyboard to the left of the return key at once, releasing them, and then pressing a letter. The dead key should modify it. Input can be further modified by using the key at the same time as pressing the  and modifier.

To enable dead keys in X, a layout needs to be selected that supports it. Most European layouts already have dead keys with the default variant. However, this is not true of North American layouts. Although there is a degree of inconsistency between layouts, the easiest solution seems to be to use a layout in the form "en_US" rather than "us", for example. The layout is set in like so:

This change will come into effect when the X server is restarted. To apply the change now, use the setxkbmap</tt> tool, for example, setxkbmap en_US</tt>.

It is probably easiest to describe dead keys with examples. Although the results are locale dependent, the concepts should remain the same regardless of locale. The examples contain UTF-8, so to view them tell the browser to view the page as UTF-8, or have a UTF-8 locale already configured.

When I press and  at once, release them, and then press, 'ä' is produced. When I press and  at once, and then press, 'ë' is produced. When I press and  at once, and then press, 'á' is produced, and when I press  and  at once, release them, and then press , 'é' is produced.

By pressing, and  at once, releasing them, and then pressing , a Scandinavian 'å' is produced. Similarly, when I press, and  at once, release only the , and then press it again, '°' is produced. Although it looks like one, this (U+02DA) is not the same as a degree symbol (U+00B0).

can be used with alphabetical keys alone. For example, and, a Greek lower-case letter mu is produced. and produce a scharfes s or esszet, etc. As many European users would expect (because it is marked on their keyboard),  and  (or  depending on the keyboard layout) produces a Euro sign, '€'.

External resources

 * The Wikipedia entry for Unicode
 * The Wikipedia entry for UTF-8
 * Unicode.org
 * UTF-8.com
 * RFC 3629
 * RFC 2277
 * Characters vs. Bytes
 * Locales and Internationalization

System configuration files (in /etc)
Most system configuration files (such as ) do not support UTF-8. It is recommended to stick with the ASCII character set for these files.