/[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.19 Revision 1.41
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.19 2005/06/18 03:53:44 fox2mike Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/utf-8.xml,v 1.41 2006/07/15 17:22:49 fox2mike 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
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">
15 <mail link="fox2mike@gentoo.org">Shyam Mani</mail>
16</author>
14 17
15<abstract> 18<abstract>
16This 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
17your Gentoo Linux system, after explaining the benefits of Unicode and more 20your Gentoo Linux system, after explaining the benefits of Unicode and more
18specifically UTF-8. 21specifically UTF-8.
19</abstract> 22</abstract>
20 23
24<!-- The content of this document is licensed under the CC-BY-SA license -->
25<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
21<license /> 26<license />
22 27
23<version>2.2</version> 28<version>2.20</version>
24<date>2005-06-18</date> 29<date>2006-07-15</date>
25 30
26<chapter> 31<chapter>
27<title>Character Encodings</title> 32<title>Character Encodings</title>
28<section> 33<section>
29<title>What is a Character Encoding?</title> 34<title>What is a Character Encoding?</title>
334 your FAT filesystems or Joilet CD-ROMs.)</comment> 339 your FAT filesystems or Joilet CD-ROMs.)</comment>
335</pre> 340</pre>
336 341
337<p> 342<p>
338If you plan on mounting NTFS partitions, you may need to specify an <c>nls=</c> 343If you plan on mounting NTFS partitions, you may need to specify an <c>nls=</c>
339option with mount. For more information, see <c>man mount</c>. 344option with mount. If you plan on mounting FAT partitions, you may need to
345specify a <c>codepage=</c> option with mount. Optionally, you can also set a
346default codepage for FAT in the kernel configuration. Note that the
347<c>codepage</c> option with mount will override the kernel settings.
348</p>
349
350<pre caption="FAT settings in kernel configuration">
351File Systems --&gt;
352 DOS/FAT/NT Filesystems --&gt;
353 (437) Default codepage for fat
354</pre>
355
356<p>
357You should avoid setting <c>Default iocharset for fat</c> to UTF-8, as it is
358not recommended. Instead, you may want to pass the option utf8=true when
359mounting your FAT partitions. For further information, see <c>man mount</c> and
360the kernel documentation at
361<path>/usr/src/linux/Documentation/filesystems/vfat.txt</path>.
340</p> 362</p>
341 363
342<p> 364<p>
343For changing the encoding of filenames, <c>app-text/convmv</c> can be used. 365For changing the encoding of filenames, <c>app-text/convmv</c> can be used.
344</p> 366</p>
345 367
346<pre caption="Example usage of convmv"> 368<pre caption="Example usage of convmv">
347# <i>emerge --ask app-text/convmv</i> 369# <i>emerge --ask app-text/convmv</i>
370<comment>(Command format)</comment>
348# <i>convmv -f current-encoding -t utf-8 filename</i> 371# <i>convmv -f &lt;current-encoding&gt; -t utf-8 &lt;filename&gt;</i>
372<comment>(Substitute iso-8859-1 with the charset you are converting
373from)</comment>
374# <i>convmv -f iso-8859-1 -t utf-8 filename</i>
349</pre> 375</pre>
350 376
351<p> 377<p>
352For changing the <e>contents</e> of files, use the <c>iconv</c> utility, 378For changing the <e>contents</e> of files, use the <c>iconv</c> utility,
353bundled with <c>glibc</c>: 379bundled with <c>glibc</c>:
382making the most of Unicode. 408making the most of Unicode.
383</p> 409</p>
384 410
385<p> 411<p>
386The <c>KEYMAP</c> variable, set in <path>/etc/conf.d/keymaps</path>, should 412The <c>KEYMAP</c> variable, set in <path>/etc/conf.d/keymaps</path>, should
387have a Unicode keymap specified. To do this, simply prepend the keymap already 413have a Unicode keymap specified.
388specified there with -u.
389</p> 414</p>
390 415
391<pre caption="Example /etc/conf.d/keymaps snippet"> 416<pre caption="Example /etc/conf.d/keymaps snippet">
392<comment>(Change "uk" to your local layout)</comment> 417<comment>(Change "uk" to your local layout)</comment>
393KEYMAP="-u uk" 418KEYMAP="uk"
394</pre> 419</pre>
395 420
396</body> 421</body>
397</section> 422</section>
398<section> 423<section>
405</note> 430</note>
406 431
407<p> 432<p>
408It is wise to add <c>unicode</c> to your global USE flags in 433It is wise to add <c>unicode</c> to your global USE flags in
409<path>/etc/make.conf</path>, and then to remerge <c>sys-libs/ncurses</c> and 434<path>/etc/make.conf</path>, and then to remerge <c>sys-libs/ncurses</c> and
410also <c>sys-libs/slang</c> if appropriate: 435<c>sys-libs/slang</c> if appropriate. Portage will do this automatically when
436you update your system:
411</p> 437</p>
412 438
413<pre caption="Emerging ncurses and slang"> 439<pre caption="Updating your system">
414<comment>(We avoid putting these libraries in our world file with --oneshot)</comment> 440# <i>emerge --update --deep --newuse world</i>
415# <i>emerge --oneshot --verbose --ask sys-libs/ncurses sys-libs/slang</i>
416</pre> 441</pre>
417 442
418<p> 443<p>
419We also need to rebuild packages that link to these, now the USE changes have 444We also need to rebuild packages that link to these, now the USE changes have
420been applied. The tool we use (<c>revdep-rebuild</c>) is part of the 445been applied. The tool we use (<c>revdep-rebuild</c>) is part of the
509 534
510<p> 535<p>
511Terminal emulators that use Xft and support Unicode are harder to come by. 536Terminal emulators that use Xft and support Unicode are harder to come by.
512Aside from Konsole and gnome-terminal, the best options in Portage are 537Aside from Konsole and gnome-terminal, the best options in Portage are
513<c>x11-terms/rxvt-unicode</c>, <c>xfce-extra/terminal</c>, 538<c>x11-terms/rxvt-unicode</c>, <c>xfce-extra/terminal</c>,
514<c>gnustep-apps/terminal</c>, <c>x11-terms/mlterm</c>, <c>x11-terms/mrxvt</c> or 539<c>gnustep-apps/terminal</c>, <c>x11-terms/mlterm</c>, or plain
515plain <c>x11-terms/xterm</c> when built with the <c>unicode</c> USE flag and 540<c>x11-terms/xterm</c> when built with the <c>unicode</c> USE flag and invoked
516invoked as <c>uxterm</c>. <c>app-misc/screen</c> supports UTF-8 too, when 541as <c>uxterm</c>. <c>app-misc/screen</c> supports UTF-8 too, when invoked as
517invoked as <c>screen -u</c> or the following is put into the 542<c>screen -U</c> or the following is put into the <path>~/.screenrc</path>:
518<path>~/.screenrc</path>:
519</p> 543</p>
520 544
521<pre caption="~/.screenrc for UTF-8"> 545<pre caption="~/.screenrc for UTF-8">
522defutf8 on 546defutf8 on
523</pre> 547</pre>
527<section> 551<section>
528<title>Vim, Emacs, Xemacs and Nano</title> 552<title>Vim, Emacs, Xemacs and Nano</title>
529<body> 553<body>
530 554
531<p> 555<p>
532Vim, Emacs and Xemacs provide full UTF-8 support, and also have builtin 556Vim provides full UTF-8 support, and also has builtin detection of UTF-8 files.
533detection of UTF-8 files. For further information in Vim, use <c>:help 557For further information in Vim, use <c>:help mbyte.txt</c>.
534mbyte.txt</c>.
535</p>
536
537<p> 558</p>
538Nano currently does not provide support for UTF-8, although it has been planned 559
539for a long time. With luck, this will change in future. At the time of writing, 560<p>
540UTF-8 support is in Nano's CVS, and should be included in the next release. 561Emacs 22.x and higher has full UTF-8 support as well. Xemacs 22.x does not
562support combining characters yet.
563</p>
564
565<p>
566Lower versions of Emacs and/or Xemacs might require you to install
567<c>app-emacs/mule-ucs</c> and/or <c>app-xemacs/mule-ucs</c>
568and add the following code to your <path>~/.emacs</path> to have support for CJK
569languages in UTF-8:
570</p>
571
572<pre caption="Emacs CJK UTF-8 support">
573(require 'un-define)
574(require 'jisx0213)
575(set-language-environment "Japanese")
576(set-default-coding-systems 'utf-8)
577(set-terminal-coding-system 'utf-8)
578</pre>
579
580<p>
581Nano has provided full UTF-8 support since version 1.3.6.
541</p> 582</p>
542 583
543</body> 584</body>
544</section> 585</section>
545<section> 586<section>
562<section> 603<section>
563<title>Irssi</title> 604<title>Irssi</title>
564<body> 605<body>
565 606
566<p> 607<p>
567Since 0.8.10, Irssi has complete UTF-8 support, although it does require a user 608Irssi has complete UTF-8 support, although it does require a user
568to set an option. 609to set an option.
569</p> 610</p>
570 611
571<pre caption="Enabling UTF-8 in Irssi"> 612<pre caption="Enabling UTF-8 in Irssi">
572/set term_charset UTF-8 613/set term_charset UTF-8
584<title>Mutt</title> 625<title>Mutt</title>
585<body> 626<body>
586 627
587<p> 628<p>
588The Mutt mail user agent has very good Unicode support. To use UTF-8 with Mutt, 629The Mutt mail user agent has very good Unicode support. To use UTF-8 with Mutt,
589put the following in your <path>~/.muttrc</path>: 630you don't need to put anything in your configuration files. Mutt will work
590</p> 631under unicode enviroment without modification if all your configuration files
591 632(signature included) are UTF-8 encoded.
592<pre caption="~/.muttrc for UTF-8">
593set send_charset="utf8" <comment>(outgoing character set)</comment>
594set charset="utf8" <comment>(display character set)</comment>
595</pre> 633</p>
596 634
597<note> 635<note>
598You may still see '?' in mail you read with Mutt. This is a result of people 636You may still see '?' in mail you read with Mutt. This is a result of people
599using a mail client which does not indicate the used charset. You can't do much 637using a mail client which does not indicate the used charset. You can't do much
600about this than to ask them to configure their client correctly. 638about this than to ask them to configure their client correctly.
601</note> 639</note>
602 640
603<p> 641<p>
604Further information is available from the <uri 642Further information is available from the <uri
605link="http://wiki.mutt.org/index.cgi?MuttFaq/Charset"> Mutt WikiWiki</uri>. 643link="http://wiki.mutt.org/index.cgi?MuttFaq/Charset">Mutt Wiki</uri>.
606</p> 644</p>
607 645
608</body> 646</body>
609</section> 647</section>
610<section> 648<section>
641<pre caption="man.conf changes for Unicode support"> 679<pre caption="man.conf changes for Unicode support">
642<comment>(This is the old line)</comment> 680<comment>(This is the old line)</comment>
643NROFF /usr/bin/nroff -Tascii -c -mandoc 681NROFF /usr/bin/nroff -Tascii -c -mandoc
644<comment>(Replace the one above with this)</comment> 682<comment>(Replace the one above with this)</comment>
645NROFF /usr/bin/nroff -mandoc -c 683NROFF /usr/bin/nroff -mandoc -c
684</pre>
685
686</body>
687</section>
688<section>
689<title>elinks and links</title>
690<body>
691
692<p>
693These are commonly used text-based browsers, and we shall see how we can enable
694UTF-8 support on them. On <c>elinks</c> and <c>links</c>, there are two ways to
695go about this, one using the Setup option from within the browser or editing the
696config file. To set the option through the browser, open a site with
697<c>elinks</c> or <c>links</c> and then <c>Alt+S</c> to enter the Setup Menu then
698select Terminal options, or press <c>T</c>. Scroll down and select the last
699option <c>UTF-8 I/O</c> by pressing Enter. Then Save and exit the menu. On
700<c>links</c> you may have to do a repeat <c>Alt+S</c> and then press <c>S</c> to
701save. The config file option, is shown below.
702</p>
703
704<pre caption="Enabling UTF-8 for elinks/links">
705<comment>(For elinks, edit /etc/elinks/elinks.conf or ~/.elinks/elinks.conf and
706add the following line)</comment>
707set terminal.linux.utf_8_io = 1
708
709<comment>(For links, edit ~/.links/links.cfg and add the following
710line)</comment>
711terminal "xterm" 0 1 0 us-ascii utf-8
712</pre>
713
714</body>
715</section>
716<section>
717<title>Samba</title>
718<body>
719
720<p>
721Samba is a software suite which implements the SMB (Server Message Block)
722protocol for UNIX systems such as Macs, Linux and FreeBSD. The protocol
723is also sometimes referred to as the Common Internet File System (CIFS). Samba
724also includes the NetBOIS system - used for file sharing over windows networks.
725</p>
726
727<pre caption="Enabling UTF-8 for Samba">
728<comment>(Edit /etc/samba/smb.conf and add the following under the [global] section)</comment>
729dos charset = 1255
730unix charset = UTF-8
731display charset = UTF-8
646</pre> 732</pre>
647 733
648</body> 734</body>
649</section> 735</section>
650<section> 736<section>
751 837
752<p> 838<p>
753AltGr can be used with alphabetical keys alone. For example, AltGr and m, a 839AltGr can be used with alphabetical keys alone. For example, AltGr and m, a
754Greek lower-case letter mu is produced: 'µ'. AltGr and s produce a 840Greek lower-case letter mu is produced: 'µ'. AltGr and s produce a
755scharfes s or esszet: 'ß'. As many European users would expect (because 841scharfes s or esszet: 'ß'. As many European users would expect (because
756it is marked on their keyboard), AltGr and 4 produces a Euro sign, '€'. 842it is marked on their keyboard), AltGr and 4 (or E depending on the keyboard
843layout) produces a Euro sign, '€'.
757</p> 844</p>
758 845
759</body> 846</body>
760</section> 847</section>
761<section> 848<section>
762<title>Resources</title> 849<title>Resources</title>
763<body> 850<body>
764 851
765<ul> 852<ul>
766 <li> 853 <li>
767 <uri link="http://www.wikipedia.com/wiki/Unicode">The Wikipedia entry for 854 <uri link="http://en.wikipedia.org/wiki/Unicode">The Wikipedia entry for
768 Unicode</uri> 855 Unicode</uri>
769 </li> 856 </li>
770 <li> 857 <li>
771 <uri link="http://www.wikipedia.com/wiki/UTF-8">The Wikipedia entry for 858 <uri link="http://en.wikipedia.org/wiki/UTF-8">The Wikipedia entry for
772 UTF-8</uri> 859 UTF-8</uri>
773 </li> 860 </li>
774 <li><uri link="http://www.unicode.org">Unicode.org</uri></li> 861 <li><uri link="http://www.unicode.org">Unicode.org</uri></li>
775 <li><uri link="http://www.utf-8.com">UTF-8.com</uri></li> 862 <li><uri link="http://www.utf-8.com">UTF-8.com</uri></li>
776 <li><uri link="http://www.ietf.org/rfc/rfc3629.txt">RFC 3629</uri></li> 863 <li><uri link="http://www.ietf.org/rfc/rfc3629.txt">RFC 3629</uri></li>

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.20