syncing docs from 3.0 tree (thanks jelmer).
[Samba.git] / docs / docbook / projdoc / unicode.xml
blob28d6f76cdf23be9afe75ea5ee7f6552b613017b6
1 <chapter id="unicode">
2 <chapterinfo>
3         &author.jelmer;
4         <author>
5                 <firstname>TAKAHASHI</firstname><surname>Motonobu</surname>
6                 <affiliation>
7                 <address><email>monyo@home.monyo.com</email></address>
8                 </affiliation>
9         </author>
10         <pubdate>25 March 2003</pubdate>
11 </chapterinfo>
13 <title>Unicode/Charsets</title>
15 <sect1>
16 <title>Features and Benefits</title>
18 <para>
19 Every industry eventually matures. One of the great areas of maturation is in
20 the focus that has been given over the past decade to make it possible for anyone
21 anywhere to use a computer. It has not always been that way, in fact, not so long
22 ago it was common for software to be written for exclusive use in the country of
23 origin.
24 </para>
26 <para>
27 Of all the effort that has been brought to bear on providing native language support
28 for all computer users, the efforts of the <ulink url="http://www.openi18n.org/">Openi18n organisation</ulink> is deserving of
29 special mention.
30 </para>
32 <para>
33 Samba-2.x supported a single locale through a mechanism called 
34 <emphasis>codepages</emphasis>. Samba-3 is destined to become a truly trans-global
35 file and printer sharing platform.
36 </para>
38 </sect1>
40 <sect1>
41 <title>What are charsets and unicode?</title>
43 <para>
44 Computers communicate in numbers. In texts, each number will be 
45 translated to a corresponding letter. The meaning that will be assigned 
46 to a certain number depends on the <emphasis>character set(charset)
47 </emphasis> that is used. 
48 A charset can be seen as a table that is used to translate numbers to 
49 letters. Not all computers use the same charset (there are charsets 
50 with German umlauts, Japanese characters, etc). Usually a charset contains 
51 256 characters, which means that storing a character with it takes 
52 exactly one byte. </para>
54 <para>
55 There are also charsets that support even more characters, 
56 but those need twice(or even more) as much storage space. These 
57 charsets can contain <command>256 * 256 = 65536</command> characters, which
58 is more then all possible characters one could think of. They are called 
59 multibyte charsets (because they use more then one byte to 
60 store one character). 
61 </para>
63 <para>
64         A standardised multibyte charset is <ulink url="http://www.unicode.org/">unicode</ulink>.
65 A big advantage of using a multibyte charset is that you only need one; there 
66 is no need to make sure two computers use the same charset when they are 
67 communicating.
68 </para>
70 <para>Old windows clients use single-byte charsets, named 
71 'codepages' by Microsoft. However, there is no support for 
72 negotiating the charset to be used in the smb protocol. Thus, you 
73 have to make sure you are using the same charset when talking to an older client.
74 Newer clients (Windows NT, 2K, XP) talk unicode over the wire.
75 </para>
76 </sect1>
78 <sect1>
79 <title>Samba and charsets</title>
81 <para>
82 As of samba 3.0, samba can (and will) talk unicode over the wire. Internally, 
83 samba knows of three kinds of character sets: 
84 </para>
86 <variablelist>
87         <varlistentry>
88                 <term><smbconfoption><name>unix charset</name></smbconfoption></term>
89                 <listitem><para>
90                 This is the charset used internally by your operating system. 
91                 The default is <constant>UTF-8</constant>, which is fine for most 
92                 systems. The default in previous samba releases was <constant>ASCII</constant>. 
93                 </para></listitem>
94         </varlistentry>
96         <varlistentry>
97                 <term><smbconfoption><name>display charset</name></smbconfoption></term>
98                 <listitem><para>This is the charset samba will use to print messages
99                 on your screen. It should generally be the same as the <command>unix charset</command>.
100                 </para></listitem>
101         </varlistentry>
103         <varlistentry>
104                 <term><smbconfoption><name>dos charset</name></smbconfoption></term>
105                 <listitem><para>This is the charset samba uses when communicating with 
106                 DOS and Windows 9x clients. It will talk unicode to all newer clients.
107                 The default depends on the charsets you have installed on your system.
108                 Run <command>testparm -v | grep "dos charset"</command> to see 
109                 what the default is on your system. 
110                 </para></listitem>
111         </varlistentry>
112 </variablelist>
114 </sect1>
116 <sect1>
117 <title>Conversion from old names</title>
119 <para>Because previous samba versions did not do any charset conversion, 
120 characters in filenames are usually not correct in the unix charset but only 
121 for the local charset used by the DOS/Windows clients.</para>
123 <para>Bjoern Jacke has written a utility named <ulink url="http://j3e.de/linux/convmv/">convm</ulink> that can convert whole directory 
124         structures to different charsets with one single command. 
125 </para>
127 </sect1>
129 <sect1>
130 <title>Japanese charsets</title>
132 <para>Samba doesn't work correctly with Japanese charsets yet. Here are
133 points of attention when setting it up:</para>
135 <itemizedlist>
137         <listitem><para>You should set <smbconfoption><name>mangling method</name><value>hash</value></smbconfoption></para></listitem>
139 <listitem><para>There are various iconv() implementations around and not
140 all of  them work equally well. glibc2's iconv() has a critical problem
141 in CP932.  libiconv-1.8 works with CP932 but still has some problems and
142 does not  work with EUC-JP.</para></listitem>
144 <listitem><para>You should set <smbconfoption><name>dos charset</name><value>CP932</value></smbconfoption>, not
145 Shift_JIS, SJIS...</para></listitem>
147 <listitem><para>Currently only <smbconfoption><name>unix charset</name><value>CP932</value></smbconfoption>
148 will work (but still has some problems...) because of iconv() issues.
149 <smbconfoption><name>unix charset</name><value>EUC-JP</value></smbconfoption> doesn't work well because of
150 iconv() issues.</para></listitem>
152 <listitem><para>Currently Samba 3.0 does not support <smbconfoption><name>unix charset</name><value>UTF8-MAC/CAP/HEX/JIS*</value></smbconfoption></para></listitem>
154 </itemizedlist>
156 <para>More information (in Japanese) is available at: <ulink noescape="1" url="http://www.atmarkit.co.jp/flinux/special/samba3/samba3a.html">http://www.atmarkit.co.jp/flinux/special/samba3/samba3a.html</ulink>.</para>
158 </sect1>
160 <sect1>
161         <title>Common errors</title>
163         <sect2>
164                 <title>CP850.so can't be found</title>
166                 <para><quote>Samba is complaining about a missing <filename>CP850.so</filename> file</quote>.</para>
168                 <para>CP850 is the default <smbconfoption><name>dos charset</name></smbconfoption>. The <smbconfoption><name>dos charset</name></smbconfoption> is used to convert data to the codepage used by your dos clients. If you don't have any dos clients, you can safely ignore this message. </para>
170                 <para>CP850 should be supported by your local iconv implementation. Make sure you have all the required packages installed. If you compiled samba from source, make sure configure found iconv.</para>
171         </sect2>
172 </sect1>
174 </chapter>