summaryrefslogtreecommitdiff
path: root/docs/htmldocs/unicode.html
blob: d11c9e1c3471aaabc60285acd1c9fee0861d7658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Unicode/Charsets</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="SAMBA Project Documentation"
HREF="samba-howto-collection.html"><LINK
REL="UP"
TITLE="Advanced Configuration"
HREF="optional.html"><LINK
REL="PREVIOUS"
TITLE="Securing Samba"
HREF="securing-samba.html"><LINK
REL="NEXT"
TITLE="Appendixes"
HREF="appendixes.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SAMBA Project Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="securing-samba.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="appendixes.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="UNICODE"
></A
>Chapter 26. Unicode/Charsets</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>26.1. <A
HREF="unicode.html#AEN4132"
>What are charsets and unicode?</A
></DT
><DT
>26.2. <A
HREF="unicode.html#AEN4141"
>Samba and charsets</A
></DT
><DT
>26.3. <A
HREF="unicode.html#AEN4160"
>Conversion from old names</A
></DT
><DT
>26.4. <A
HREF="unicode.html#AEN4168"
>Japanese charsets</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN4132"
>26.1. What are charsets and unicode?</A
></H1
><P
>Computers communicate in numbers. In texts, each number will be 
translated to a corresponding letter. The meaning that will be assigned 
to a certain number depends on the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>character set(charset)</I
></SPAN
> that is used. 
A charset can be seen as a table that is used to translate numbers to 
letters. Not all computers use the same charset (there are charsets 
with German umlauts, Japanese characters, etc). Usually a charset contains 
256 characters, which means that storing a character with it takes 
exactly one byte. </P
><P
>There are also charsets that support even more characters, 
but those need twice(or even more) as much storage space. These 
charsets can contain <B
CLASS="COMMAND"
>256 * 256 = 65536</B
> characters, which
is more then all possible characters one could think of. They are called 
multibyte charsets (because they use more then one byte to 
store one character). </P
><P
>A standardised multibyte charset is unicode, info available at 
<A
HREF="http://www.unicode.org/"
TARGET="_top"
>www.unicode.org</A
>. 
Big advantage of using a multibyte charset is that you only need one; no 
need to make sure two computers use the same charset when they are 
communicating.</P
><P
>Old windows clients used to use single-byte charsets, named 
'codepages' by microsoft. However, there is no support for 
negotiating the charset to be used in the smb protocol. Thus, you 
have to make sure you are using the same charset when talking to an old client.
Newer clients (Windows NT, 2K, XP) talk unicode over the wire.</P
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN4141"
>26.2. Samba and charsets</A
></H1
><P
>As of samba 3.0, samba can (and will) talk unicode over the wire. Internally, 
samba knows of three kinds of character sets: </P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>unix charset</DT
><DD
><P
>		This is the charset used internally by your operating system. 
		The default is <CODE
CLASS="CONSTANT"
>ASCII</CODE
>, which is fine for most 
		systems.
		</P
></DD
><DT
>display charset</DT
><DD
><P
>This is the charset samba will use to print messages
		on your screen. It should generally be the same as the <B
CLASS="COMMAND"
>unix charset</B
>.
		</P
></DD
><DT
>dos charset</DT
><DD
><P
>This is the charset samba uses when communicating with 
		DOS and Windows 9x clients. It will talk unicode to all newer clients.
		The default depends on the charsets you have installed on your system.
		Run <B
CLASS="COMMAND"
>testparm -v | grep "dos charset"</B
> to see 
		what the default is on your system. 
		</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN4160"
>26.3. Conversion from old names</A
></H1
><P
>Because previous samba versions did not do any charset conversion, 
characters in filenames are usually not correct in the unix charset but only 
for the local charset used by the DOS/Windows clients.</P
><P
>The following script from Steve Langasek converts all 
filenames from CP850 to the iso8859-15 charset.</P
><P
><SAMP
CLASS="PROMPT"
>#</SAMP
><KBD
CLASS="USERINPUT"
>find <VAR
CLASS="REPLACEABLE"
>/path/to/share</VAR
> -type f -exec bash -c 'CP="{}"; ISO=`echo -n "$CP" | iconv -f cp850 \
  -t iso8859-15`; if [ "$CP" != "$ISO" ]; then mv "$CP" "$ISO"; fi' \;</KBD
></P
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN4168"
>26.4. Japanese charsets</A
></H1
><P
>Samba doesn't work correctly with Japanese charsets yet. Here are points of attention when setting it up:</P
><P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
>You should set <B
CLASS="COMMAND"
>mangling method = hash</B
></TD
></TR
><TR
><TD
>There are various iconv() implementations around and not all of 
them work equally well. glibc2's iconv() has a critical problem in CP932. 
libiconv-1.8 works with CP932 but still has some problems and does not 
work with EUC-JP. </TD
></TR
><TR
><TD
>You should set <B
CLASS="COMMAND"
>dos charset = CP932</B
>, not Shift_JIS, SJIS...</TD
></TR
><TR
><TD
>Currently only <B
CLASS="COMMAND"
>unix charset = CP932</B
> will work (but still has some problems...) because of iconv() issues. <B
CLASS="COMMAND"
>unix charset = EUC-JP</B
> doesn't work well because of iconv() issues.</TD
></TR
><TR
><TD
>Currently Samba 3.0 does not support <B
CLASS="COMMAND"
>unix charset = UTF8-MAC/CAP/HEX/JIS*</B
></TD
></TR
></TBODY
></TABLE
><P
></P
><P
>More information (in Japanese) is available at: <A
HREF="http://www.atmarkit.co.jp/flinux/special/samba3/samba3a.html"
TARGET="_top"
>http://www.atmarkit.co.jp/flinux/special/samba3/samba3a.html</A
>.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="securing-samba.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="samba-howto-collection.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="appendixes.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Securing Samba</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="optional.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Appendixes</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>