OSDN Git Service

0564b3dde9f9d26d0e21417337044f936c1d0530
[nkf/nkf.git] / man / nkf.1.pm
1 # Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
2 # Copyright (c) 1996-2009, The nkf Project.
3 # All rights reserved.
4 #
5 # This software is provided 'as-is', without any express or implied
6 # warranty. In no event will the authors be held liable for any damages
7 # arising from the use of this software.
8 #
9 # Permission is granted to anyone to use this software for any purpose,
10 # including commercial applications, and to alter it and redistribute it
11 # freely, subject to the following restrictions:
12 #
13 # 1. The origin of this software must not be misrepresented; you must not
14 # claim that you wrote the original software. If you use this software
15 # in a product, an acknowledgment in the product documentation would be
16 # appreciated but is not required.
17 #
18 # 2. Altered source versions must be plainly marked as such, and must not be
19 # misrepresented as being the original software.
20 #
21 # 3. This notice may not be removed or altered from any source distribution.
22
23 package NKF;
24
25 use strict;
26 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
27
28 require Exporter;
29 require DynaLoader;
30
31 @ISA = qw(Exporter DynaLoader);
32 # Items to export into callers namespace by default. Note: do not export
33 # names by default without a very good reason. Use EXPORT_OK instead.
34 # Do not simply export all your public functions/methods/constants.
35 @EXPORT = qw(
36         nkf     nkf_continue    inputcode
37 );
38 $VERSION = '2.09';
39
40 bootstrap NKF $VERSION;
41
42 # Preloaded methods go here.
43
44 # Autoload methods go after =cut, and are processed by the autosplit program.
45
46 1;
47 __END__
48
49 #
50
51
52 =head1 NAME
53
54
55 nkf - Network Kanji Filter
56
57
58 =head1 SYNOPSIS
59
60
61 nkf B<[-butjnesliohrTVvwWJESZxXFfmMBOcdILg]> B<[>I<file ...>B<]>
62
63
64 =head1 DESCRIPTION
65
66
67 B<Nkf> is a yet another kanji code converter among networks, hosts and terminals.
68 It converts input kanji code to designated kanji code
69 such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8, UTF-16 or UTF-32.
70
71 One of the most unique faculty of B<nkf> is the guess of the input kanji encodings.
72 It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8, UTF-16 and UTF-32.
73 So users needn't set the input kanji code explicitly.
74
75 By default, X0201 kana is converted into X0208 kana.
76 For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported.
77 For automatic code detection, nkf assumes no X0201 kana in Shift_JIS.
78 To accept X0201 in Shift_JIS, use B<-X>, B<-x> or B<-S>.
79
80 =head1 OPTIONS
81
82 =over
83
84 =item B<-J -S -E -W -W16 -W32 -j -s -e -w -w16 -w32>
85
86 Specify input and output encodings. Upper case is input.
87 cf. --ic and --oc.
88
89 =over
90
91 =item B<-J>
92
93 ISO-2022-JP (JIS code).
94
95 =item B<-S>
96
97 Shift_JIS and JIS X 0201 kana.
98 EUC-JP is recognized as X0201 kana. Without B<-x> flag,
99 JIS X 0201 Katakana (a.k.a.halfwidth kana) is converted into JIS X 0208.
100 If you use Windows, see Windows-31J (CP932).
101
102 =item B<-E>
103
104 EUC-JP.
105
106 =item B<-W>
107
108 UTF-8N.
109
110 =item B<-W16[BL][0]>
111
112 UTF-16.
113 B or L gives whether Big Endian or Little Endian.
114 0 gives whther put BOM or not.
115
116 =item B<-W32[BL][0]>
117
118 UTF-32.
119 B or L gives whether Big Endian or Little Endian.
120 0 gives whther put BOM or not.
121
122 =back
123
124 =item B<-b -u>
125
126 Output is buffered (DEFAULT), Output is unbuffered.
127
128 =item B<-t>
129
130 No conversion.
131
132 =item B<-i[@B]>
133
134 Specify the escape sequence for JIS X 0208.
135
136 =over
137
138 =item B<-i@>
139
140 Use ESC ( @. (JIS X 0208-1978)
141
142 =item B<-iB>
143
144 Use ESC ( B. (JIS X 0208-1983/1990 DEFAULT)
145
146 =back
147
148 =item B<-o[BJ]>
149
150 Specify the escape sequence for US-ASCII/JIS X 0201 Roman. (DEFAULT B)
151
152 =item B<-r>
153
154 {de/en}crypt ROT13/47
155
156 =item B<-h[123] --hiragana --katakana --katakana-hiragana>
157
158 =over
159
160 =item B<-h1 --hiragana>
161
162 Katakana to Hiragana conversion.
163
164 =item B<-h2 --katakana>
165
166 Hiragana to Katakana conversion.
167
168 =item B<-h3 --katakana-hiragana>
169
170 Katakana to Hiragana and Hiragana to Katakana conversion.
171
172 =back
173
174 =item B<-T>
175
176 Text mode output (MS-DOS)
177
178 =item B<-l>
179
180 ISO8859-1 (Latin-1) support
181
182 =item B<-f[I<m> [- I<n>]]>
183
184 Folding on I<m> length with I<n> margin in a line.
185 Without this option, fold length is 60 and fold margin is 10.
186
187 =item B<-F>
188
189 New line preserving line folding.
190
191 =item B<-Z[0-3]>
192
193 Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
194
195 =over
196
197 =item B<-Z -Z0>
198
199 Convert X0208 alphabet to ASCII.
200
201 =item B<-Z1>
202
203 Convert X0208 kankaku to single ASCII space.
204
205 =item B<-Z2>
206
207 Convert X0208 kankaku to double ASCII spaces.
208
209 =item B<-Z3>
210
211 Replacing fullwidth >, <, ", & into '&gt;', '&lt;', '&quot;', '&amp;' as in HTML.
212
213 =back
214
215 =item B<-X -x>
216
217 Assume X0201 kana in MS-Kanji.
218 With B<-X> or without this option, X0201 is converted into X0208 Kana.
219 With B<-x>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
220 In JIS output, ESC-(-I is used. In EUC output, SSO is used.
221
222 =item B<-B[0-2]>
223
224 Assume broken JIS-Kanji input, which lost ESC.
225 Useful when your site is using old B-News Nihongo patch.
226
227 =over
228
229 =item B<-B1>
230
231 allows any chars after ESC-( or ESC-$.
232
233 =item B<-B2>
234
235 force ASCII after NL.
236
237 =back
238
239 =item B<-I>
240
241 Replacing non iso-2022-jp char into a geta character
242 (substitute character in Japanese).
243
244 =item B<-m[BQN0]>
245
246 MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
247 To see ISO8859-1 (Latin-1) -l is necessary.
248
249 =over
250
251 =item B<-mB>
252
253 Decode MIME base64 encoded stream. Remove header or other part before
254 conversion. 
255
256 =item B<-mQ>
257
258 Decode MIME quoted stream. '_' in quoted stream is converted to space.
259
260 =item B<-mN>
261
262 Non-strict decoding.
263 It allows line break in the middle of the base64 encoding.
264
265 =item B<-m0>
266
267 No MIME decode.
268
269 =back
270
271 =item B<-M>
272
273 MIME encode. Header style. All ASCII code and control characters are intact.
274
275 =over
276
277 =item B<-MB>
278
279 MIME encode Base64 stream.
280 Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.
281
282 =item B<-MQ>
283
284 Perform quoted encoding.
285
286 =back
287
288 =item B<-l>
289
290 Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
291 B<-s>, B<-e> and B<-x> are not compatible with this option.
292
293 =item B<-L[uwm] -d -c>
294
295 Convert line breaks.
296
297 =over
298
299 =item B<-Lu -d>
300
301 unix (LF)
302
303 =item B<-Lw -c>
304
305 windows (CRLF)
306
307 =item B<-Lm>
308
309 mac (CR)
310
311 Without this option, nkf doesn't convert line breaks.
312
313 =back
314
315 =item B<--fj --unix --mac --msdos --windows>
316
317 Convert for these systems.
318
319 =item B<--jis --euc --sjis --mime --base64>
320
321 Convert to named code.
322
323 =item B<--jis-input --euc-input --sjis-input --mime-input --base64-input>
324
325 Assume input system
326
327 =item B<--ic=I<input codeset> --oc=I<output codeset>>
328
329 Set the input or output codeset.
330 NKF supports following codesets and those codeset names are case insensitive.
331
332 =over
333
334 =item ISO-2022-JP
335
336 a.k.a. RFC1468, 7bit JIS, JUNET
337
338 =item EUC-JP (eucJP-nkf)
339
340 a.k.a. AT&T JIS, Japanese EUC, UJIS
341
342 =item eucJP-ascii
343
344 =item eucJP-ms
345
346 =item CP51932
347
348 Microsoft Version of EUC-JP.
349
350 =item Shift_JIS
351
352 a.k.a. SJIS, MS-Kanji
353
354 =item Windows-31J
355
356 a.k.a. CP932
357
358 =item UTF-8
359
360 same as UTF-8N
361
362 =item UTF-8N
363
364 UTF-8 without BOM
365
366 =item UTF-8-BOM
367
368 UTF-8 with BOM
369
370 =item UTF8-MAC (input only)
371
372 decomposed UTF-8
373
374 =item UTF-16
375
376 same as UTF-16BE
377
378 =item UTF-16BE
379
380 UTF-16 Big Endian without BOM
381
382 =item UTF-16BE-BOM
383
384 UTF-16 Big Endian with BOM
385
386 =item UTF-16LE
387
388 UTF-16 Little Endian without BOM
389
390 =item UTF-16LE-BOM
391
392 UTF-16 Little Endian with BOM
393
394 =item UTF-32
395
396 same as UTF-32BE
397
398 =item UTF-32BE
399
400 UTF-32 Big Endian without BOM
401
402 =item UTF-32BE-BOM
403
404 UTF-32 Big Endian with BOM
405
406 =item UTF-32LE
407
408 UTF-32 Little Endian without BOM
409
410 =item UTF-32LE-BOM
411
412 UTF-32 Little Endian with BOM
413
414 =back
415
416 =item B<--fb-{skip, html, xml, perl, java, subchar}>
417
418 Specify the way that nkf handles unassigned characters.
419 Without this option, --fb-skip is assumed.
420
421 =item B<--prefix=I<escape character>I<target character>..>
422
423 When nkf converts to Shift_JIS,
424 nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters.
425 1st byte of argument is the escape character and following bytes are target characters.
426
427 =item B<--no-cp932ext>
428
429 Handle the characters extended in CP932 as unassigned characters.
430
431 =item B<--no-best-fit-chars>
432
433 When Unicode to Encoded byte conversion,
434 don't convert characters which is not round trip safe.
435 When Unicode to Unicode conversion,
436 with this and -x option, nkf can be used as UTF converter.
437 (In other words, without this and -x option, nkf doesn't save some characters)
438
439 When nkf converts strings that related to path, you should use this opion.
440
441 =item B<--cap-input>
442
443 Decode hex encoded characters.
444
445 =item B<--url-input>
446
447 Unescape percent escaped characters.
448
449 =item B<--numchar-input>
450
451 Decode character reference, such as "&#....;".
452
453
454 =item B<--in-place[=>I<SUFFIX>B<]>  B<--overwrite[=>I<SUFFIX>B<]>
455
456 Overwrite B<original> listed files by filtered result.
457
458 B<Note> --overwrite preserves timestamps of original files.
459
460 =item B<--guess=[12]>
461
462 Print guessed encoding and newline. (2 is default, 1 is only encoding)
463
464 =item B<--help>
465
466 Print nkf's help.
467
468 =item B<--version>
469
470 Print nkf's version.
471
472
473 =item B<-->
474
475 Ignore rest of -option.
476
477 =back
478
479 =head1 AUTHOR
480
481 Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
482
483 Copyright (c) 1996-2009, The nkf Project.
484
485
486 =cut