/[gentoo]/xml/htdocs/doc/en/utf-8.xml
Gentoo

Diff of /xml/htdocs/doc/en/utf-8.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.42 Revision 1.43
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/utf-8.xml,v 1.42 2006/07/15 22:06:43 rane Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/utf-8.xml,v 1.43 2006/07/19 11:56:26 rane Exp $ -->
3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 4
5<guide link="/doc/en/utf-8.xml"> 5<guide link="/doc/en/utf-8.xml">
6<title>Using UTF-8 with Gentoo</title> 6<title>Using UTF-8 with Gentoo</title>
7 7
8<author title="Author"> 8<author title="Author">
9 <mail link="slarti@gentoo.org">Thomas Martin</mail> 9 <mail link="slarti@gentoo.org">Thomas Martin</mail>
10</author> 10</author>
11<author title="Contributor"> 11<author title="Contributor">
12 <mail link="devil@gentoo.org.ua">Alexander Simonov</mail> 12 <mail link="devil@gentoo.org.ua">Alexander Simonov</mail>
13</author> 13</author>
14<author title="Editor"> 14<author title="Editor">
15 <mail link="fox2mike@gentoo.org">Shyam Mani</mail> 15 <mail link="fox2mike@gentoo.org">Shyam Mani</mail>
16</author> 16</author>
17 17
18<abstract> 18<abstract>
19This guide shows you how to set up and use the UTF-8 Unicode character set with 19This guide shows you how to set up and use the UTF-8 Unicode character set with
20your Gentoo Linux system, after explaining the benefits of Unicode and more 20your Gentoo Linux system, after explaining the benefits of Unicode and more
21specifically UTF-8. 21specifically UTF-8.
22</abstract> 22</abstract>
23 23
24<!-- The content of this document is licensed under the CC-BY-SA license --> 24<!-- The content of this document is licensed under the CC-BY-SA license -->
25<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 25<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
26<license /> 26<license />
27 27
28<version>2.20</version> 28<version>2.21</version>
29<date>2006-07-15</date> 29<date>2006-07-18</date>
30 30
31<chapter> 31<chapter>
32<title>Character Encodings</title> 32<title>Character Encodings</title>
33<section> 33<section>
34<title>What is a Character Encoding?</title> 34<title>What is a Character Encoding?</title>
35<body> 35<body>
36 36
37<p> 37<p>
38Computers do not understand text themselves. Instead, every character is 38Computers do not understand text themselves. Instead, every character is
39represented by a number. Traditionally, each set of numbers used to represent 39represented by a number. Traditionally, each set of numbers used to represent
40alphabets and characters (known as a coding system, encoding or character set) 40alphabets and characters (known as a coding system, encoding or character set)
41was limited in size due to limitations in computer hardware. 41was limited in size due to limitations in computer hardware.
42</p> 42</p>
43 43
44</body> 44</body>
168 168
169<chapter> 169<chapter>
170<title>Setting up UTF-8 with Gentoo Linux</title> 170<title>Setting up UTF-8 with Gentoo Linux</title>
171<section> 171<section>
172<title>Finding or Creating UTF-8 Locales</title> 172<title>Finding or Creating UTF-8 Locales</title>
173<body> 173<body>
174 174
175<p> 175<p>
176Now that you understand the principles behind Unicode, you're ready to start 176Now that you understand the principles behind Unicode, you're ready to start
177using UTF-8 with your system. 177using UTF-8 with your system.
178</p> 178</p>
179 179
180<p> 180<p>
181The preliminary requirement for UTF-8 is to have a version of glibc installed 181The preliminary requirement for UTF-8 is to have a version of glibc installed
182that has national language support. The recommend means to do this is the 182that has national language support. The recommend means to do this is the
183<path>/etc/locales.build</path> file in combination with the <c>userlocales</c> 183<path>/etc/locale.gen</path> file. It is beyond the scope of this document to
184USE flag. It is beyond the scope of this document to explain the usage of this 184explain the usage of this file though. It is explained in the <uri
185file though, luckily, the usage of this file is well documented in the comments
186within it. It is also explained in the <uri
187link="/doc/en/guide-localization.xml#doc_chap3_sect3"> Gentoo Localisation 185link="/doc/en/guide-localization.xml#doc_chap3_sect3">Gentoo Localization
188Guide</uri>. 186Guide</uri>.
189</p> 187</p>
190 188
191<p> 189<p>
192Next, we'll need to decide whether a UTF-8 locale is already available for our 190Next, we'll need to decide whether a UTF-8 locale is already available for our
193language, or whether we need to create one. 191language, or whether we need to create one.
194</p> 192</p>
195 193
196<pre caption="Checking for an existing UTF-8 locale"> 194<pre caption="Checking for an existing UTF-8 locale">
197<comment>(Replace "en_GB" with your desired locale setting)</comment> 195<comment>(Replace "en_GB" with your desired locale setting)</comment>
198# <i>locale -a | grep 'en_GB'</i> 196# <i>locale -a | grep 'en_GB'</i>
199en_GB 197en_GB
200en_GB.UTF-8 198en_GB.UTF-8
201</pre> 199</pre>
202 200
206<c>.UTF-8</c>, we need to create a UTF-8 compatible locale. 204<c>.UTF-8</c>, we need to create a UTF-8 compatible locale.
207</p> 205</p>
208 206
209<note> 207<note>
210Only execute the following code listing if you do not have a UTF-8 locale 208Only execute the following code listing if you do not have a UTF-8 locale
211available for your language. 209available for your language.
212</note> 210</note>
213 211
214<pre caption="Creating a UTF-8 locale"> 212<pre caption="Creating a UTF-8 locale">
215<comment>(Replace "en_GB" with your desired locale setting)</comment> 213<comment>(Replace "en_GB" with your desired locale setting)</comment>
216# <i>localedef -i en_GB -f UTF-8 en_GB.UTF-8</i> 214# <i>localedef -i en_GB -f UTF-8 en_GB.UTF-8</i>
217</pre> 215</pre>
218 216
219<p> 217<p>
220Another way to include a UTF-8 locale is to add it to the 218Another way to include a UTF-8 locale is to add it to the
221<path>/etc/locales.build</path> file and rebuild <c>glibc</c> with the 219<path>/etc/locale.gen</path> file and generate necessary locales with
222<c>userlocales</c> USE flag set. 220<c>locale-gen</c> command.
223</p> 221</p>
224 222
225<pre caption="Line in /etc/locales.build"> 223<pre caption="Line in /etc/locale.gen">
226en_GB.UTF-8/UTF-8 224en_GB.UTF-8 UTF-8
227</pre> 225</pre>
228 226
229</body> 227</body>
230</section> 228</section>
231<section> 229<section>
232<title>Setting the Locale</title> 230<title>Setting the Locale</title>
233<body> 231<body>
234 232
235<p> 233<p>
236There is one environment variable that needs to be set in order to use 234There is one environment variable that needs to be set in order to use
237our new UTF-8 locales: <c>LC_ALL</c> (this variable overrides the <c>LANG</c> 235our new UTF-8 locales: <c>LC_ALL</c> (this variable overrides the <c>LANG</c>
238setting as well). There are also many different ways to set it; some people 236setting as well). There are also many different ways to set it; some people
239prefer to only have a UTF-8 environment for a specific user, in which case 237prefer to only have a UTF-8 environment for a specific user, in which case
240they set them in their <path>~/.profile</path> (if you use <c>/bin/sh</c>), 238they set them in their <path>~/.profile</path> (if you use <c>/bin/sh</c>),
241<path>~/.bash_profile</path> or <path>~/.bashrc</path> (if you use 239<path>~/.bash_profile</path> or <path>~/.bashrc</path> (if you use

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

  ViewVC Help
Powered by ViewVC 1.1.20