/[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.47 Revision 1.48
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.47 2007/04/17 19:04:17 nightmorph Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/utf-8.xml,v 1.48 2008/05/19 21:08:38 swift 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
229<section> 229<section>
230<title>Setting the Locale</title> 230<title>Setting the Locale</title>
231<body> 231<body>
232 232
233<p> 233<p>
234There is one environment variable that needs to be set in order to use our new 234There is one environment variable that needs to be set in order to use our new
235UTF-8 locales: <c>LANG</c> (you can override this variable with the 235UTF-8 locales: <c>LANG</c> (you can override this variable with the
236<c>LC_ALL</c> setting as well). There are also many different ways to set it; 236<c>LC_ALL</c> setting as well). There are also many different ways to set it;
237some people prefer to only have a UTF-8 environment for a specific user, in 237some people prefer to only have a UTF-8 environment for a specific user, in
238which case they set them in their <path>~/.profile</path> (if you use 238which case they set them in their <path>~/.profile</path> (if you use
239<c>/bin/sh</c>), <path>~/.bash_profile</path> or <path>~/.bashrc</path> (if you 239<c>/bin/sh</c>), <path>~/.bash_profile</path> or <path>~/.bashrc</path> (if you
240use <c>/bin/bash</c>). 240use <c>/bin/bash</c>).
241</p> 241</p>
242 242
243<p> 243<p>
244Others prefer to set the locale globally. One specific circumstance where 244Others prefer to set the locale globally. One specific circumstance where
245the author particularly recommends doing this is when 245the author particularly recommends doing this is when
246<path>/etc/init.d/xdm</path> is in use, because 246<path>/etc/init.d/xdm</path> is in use, because
247this init script starts the display manager and desktop before any of the 247this init script starts the display manager and desktop before any of the
248aforementioned shell startup files are sourced, and so before any of the 248aforementioned shell startup files are sourced, and so before any of the
249variables are in the environment. 249variables are in the environment.
250</p> 250</p>
251 251
252<p> 252<p>
253Setting the locale globally should be done using 253Setting the locale globally should be done using
254<path>/etc/env.d/02locale</path>. The file should look something like the 254<path>/etc/env.d/02locale</path>. The file should look something like the
255following: 255following:
256</p> 256</p>
257 257
258<pre caption="Demonstration /etc/env.d/02locale"> 258<pre caption="Demonstration /etc/env.d/02locale">
259<comment>(As always, change "en_GB.UTF-8" to your locale)</comment> 259<comment>(As always, change "en_GB.UTF-8" to your locale)</comment>
260LANG="en_GB.UTF-8" 260LANG="en_GB.UTF-8"
378<comment>(Command format)</comment> 378<comment>(Command format)</comment>
379# <i>convmv -f &lt;current-encoding&gt; -t utf-8 &lt;filename&gt;</i> 379# <i>convmv -f &lt;current-encoding&gt; -t utf-8 &lt;filename&gt;</i>
380<comment>(Substitute iso-8859-1 with the charset you are converting 380<comment>(Substitute iso-8859-1 with the charset you are converting
381from)</comment> 381from)</comment>
382# <i>convmv -f iso-8859-1 -t utf-8 filename</i> 382# <i>convmv -f iso-8859-1 -t utf-8 filename</i>
383</pre> 383</pre>
384 384
385<p> 385<p>
386For changing the <e>contents</e> of files, use the <c>iconv</c> utility, 386For changing the <e>contents</e> of files, use the <c>iconv</c> utility,
387bundled with <c>glibc</c>: 387bundled with <c>glibc</c>:
388</p> 388</p>
389 389
390<pre caption="Example usage of iconv"> 390<pre caption="Example usage of iconv">
391<comment>(substitute iso-8859-1 with the charset you are converting from)</comment> 391<comment>(substitute iso-8859-1 with the charset you are converting from)</comment>
392<comment>(Check the output is sane)</comment> 392<comment>(Check the output is sane)</comment>
393# <i>iconv -f iso-8859-1 -t utf-8 filename</i> 393# <i>iconv -f iso-8859-1 -t utf-8 filename</i>
394<comment>(Convert a file, you must create another file)</comment> 394<comment>(Convert a file, you must create another file)</comment>
395# <i>iconv -f iso-8859-1 -t utf-8 filename > newfile</i> 395# <i>iconv -f iso-8859-1 -t utf-8 filename > newfile</i>
396</pre> 396</pre>
397 397
398<p> 398<p>
399<c>app-text/recode</c> can also be used for this purpose. 399<c>app-text/recode</c> can also be used for this purpose.
400</p> 400</p>
401 401
402</body> 402</body>
403</section> 403</section>
404<section> 404<section>
405<title>The System Console</title> 405<title>The System Console</title>
406<body> 406<body>
407 407
408<impo> 408<impo>
409You need >=sys-apps/baselayout-1.11.9 for Unicode on the console. 409You need >=sys-apps/baselayout-1.11.9 for Unicode on the console.
410</impo> 410</impo>
411 411
412<p> 412<p>
413To enable UTF-8 on the console, you should edit <path>/etc/rc.conf</path> and 413To enable UTF-8 on the console, you should edit <path>/etc/rc.conf</path> and
414set <c>UNICODE="yes"</c>, and also read the comments in that file -- it is 414set <c>UNICODE="yes"</c>, and also read the comments in that file -- it is
415important to have a font that has a good range of characters if you plan on 415important to have a font that has a good range of characters if you plan on
416making the most of Unicode. For this to work, make sure you have properly 416making the most of Unicode. For this to work, make sure you have properly
417created a Unicode locale as explained in <uri link="#doc_chap1">Chapter 417created a Unicode locale as explained in <uri link="#doc_chap1">Chapter
4181</uri>. 4181</uri>.
419</p> 419</p>
420 420
421<p> 421<p>
422The <c>KEYMAP</c> variable, set in <path>/etc/conf.d/keymaps</path>, should 422The <c>KEYMAP</c> variable, set in <path>/etc/conf.d/keymaps</path>, should
423have a Unicode keymap specified. 423have a Unicode keymap specified.
424</p> 424</p>
425 425
426<pre caption="Example /etc/conf.d/keymaps snippet"> 426<pre caption="Example /etc/conf.d/keymaps snippet">
427<comment>(Change "uk" to your local layout)</comment> 427<comment>(Change "uk" to your local layout)</comment>
428KEYMAP="uk" 428KEYMAP="uk"
429</pre> 429</pre>
430 430
431</body> 431</body>
432</section> 432</section>
433<section> 433<section>
434<title>Ncurses and Slang</title> 434<title>Ncurses and Slang</title>
435<body> 435<body>
436 436
437<note> 437<note>
438Ignore any mention of Slang in this section if you do not have it installed or 438Ignore any mention of Slang in this section if you do not have it installed or
551as <c>uxterm</c>. <c>app-misc/screen</c> supports UTF-8 too, when invoked as 551as <c>uxterm</c>. <c>app-misc/screen</c> supports UTF-8 too, when invoked as
552<c>screen -U</c> or the following is put into the <path>~/.screenrc</path>: 552<c>screen -U</c> or the following is put into the <path>~/.screenrc</path>:
553</p> 553</p>
554 554
555<pre caption="~/.screenrc for UTF-8"> 555<pre caption="~/.screenrc for UTF-8">
556defutf8 on 556defutf8 on
557</pre> 557</pre>
558 558
559</body> 559</body>
560</section> 560</section>
561<section> 561<section>
562<title>Vim, Emacs, Xemacs and Nano</title> 562<title>Vim, Emacs, Xemacs and Nano</title>
563<body> 563<body>
564 564
565<p> 565<p>
566Vim provides full UTF-8 support, and also has builtin detection of UTF-8 files. 566Vim provides full UTF-8 support, and also has builtin detection of UTF-8 files.
567For further information in Vim, use <c>:help mbyte.txt</c>. 567For further information in Vim, use <c>:help mbyte.txt</c>.
568</p> 568</p>
569 569
570<p> 570<p>
571Emacs 22.x and higher has full UTF-8 support as well. Xemacs 22.x does not 571Emacs 22.x and higher has full UTF-8 support as well. Xemacs 22.x does not
572support combining characters yet. 572support combining characters yet.
573</p>
574
575<p> 573</p>
574
575<p>
576Lower versions of Emacs and/or Xemacs might require you to install 576Lower versions of Emacs and/or Xemacs might require you to install
577<c>app-emacs/mule-ucs</c> and/or <c>app-xemacs/mule-ucs</c> 577<c>app-emacs/mule-ucs</c> and/or <c>app-xemacs/mule-ucs</c>
578and add the following code to your <path>~/.emacs</path> to have support for CJK 578and add the following code to your <path>~/.emacs</path> to have support for CJK
579languages in UTF-8: 579languages in UTF-8:
580</p> 580</p>
581 581
582<pre caption="Emacs CJK UTF-8 support"> 582<pre caption="Emacs CJK UTF-8 support">
583(require 'un-define) 583(require 'un-define)
584(require 'jisx0213) 584(require 'jisx0213)
585(set-language-environment "Japanese") 585(set-language-environment "Japanese")
586(set-default-coding-systems 'utf-8) 586(set-default-coding-systems 'utf-8)
587(set-terminal-coding-system 'utf-8) 587(set-terminal-coding-system 'utf-8)
588</pre> 588</pre>
589 589
590<p> 590<p>
591Nano has provided full UTF-8 support since version 1.3.6. 591Nano has provided full UTF-8 support since version 1.3.6.
647about this than to ask them to configure their client correctly. 647about this than to ask them to configure their client correctly.
648</note> 648</note>
649 649
650<p> 650<p>
651Further information is available from the <uri 651Further information is available from the <uri
652link="http://wiki.mutt.org/index.cgi?MuttFaq/Charset">Mutt Wiki</uri>. 652link="http://wiki.mutt.org/index.cgi?MuttFaq/Charset">Mutt Wiki</uri>.
653</p> 653</p>
654 654
655</body> 655</body>
656</section> 656</section>
657<section> 657<section>
658<title>Man</title> 658<title>Man</title>
659<body> 659<body>
660 660
661<p> 661<p>
662Man pages are an integral part of any Linux machine. To ensure that any 662Man pages are an integral part of any Linux machine. To ensure that any
663unicode in your man pages render correctly, edit <path>/etc/man.conf</path> 663unicode in your man pages render correctly, edit <path>/etc/man.conf</path>
664and replace a line as shown below. 664and replace a line as shown below.
665</p> 665</p>
666 666
667<pre caption="man.conf changes for Unicode support"> 667<pre caption="man.conf changes for Unicode support">
668<comment>(This is the old line)</comment> 668<comment>(This is the old line)</comment>
669NROFF /usr/bin/nroff -Tascii -c -mandoc 669NROFF /usr/bin/nroff -Tascii -c -mandoc
670<comment>(Replace the one above with this)</comment> 670<comment>(Replace the one above with this)</comment>
671NROFF /usr/bin/nroff -mandoc -c 671NROFF /usr/bin/nroff -mandoc -c
672</pre> 672</pre>
673 673
674</body> 674</body>
675</section> 675</section>
676<section> 676<section>
677<title>elinks and links</title> 677<title>elinks and links</title>
678<body> 678<body>

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

  ViewVC Help
Powered by ViewVC 1.1.20