OSDN Git Service

fix typo of 5a54b532d970b9d76862ee47b5364bcbc2f82330
[nkf/nkf.git] / man / nkf.1.pm
1 # Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
2 # Copyright (c) 1996-2015, 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.14';
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 multiple options are specifed as seprate strings, such as
81
82   print nkf('--ic=UTF8-MAC', '-w', $string), "\n";
83
84 except the last arguments.
85
86 =head1 OPTIONS
87
88 =over
89
90 =item B<-J -S -E -W -W16 -W32 -j -s -e -w -w16 -w32>
91
92 Specify input and output encodings. Upper case is input.
93 cf. --ic and --oc.
94
95 =over
96
97 =item B<-J>
98
99 ISO-2022-JP (JIS code).
100
101 =item B<-S>
102
103 Shift_JIS and JIS X 0201 kana.
104 EUC-JP is recognized as X0201 kana. Without B<-x> flag,
105 JIS X 0201 Katakana (a.k.a.halfwidth kana) is converted into JIS X 0208.
106 If you use Windows, see Windows-31J (CP932).
107
108 =item B<-E>
109
110 EUC-JP.
111
112 =item B<-W>
113
114 UTF-8N.
115
116 =item B<-W16[BL][0]>
117
118 UTF-16.
119 B or L gives whether Big Endian or Little Endian.
120 0 gives whther put BOM or not.
121
122 =item B<-W32[BL][0]>
123
124 UTF-32.
125 B or L gives whether Big Endian or Little Endian.
126 0 gives whther put BOM or not.
127
128 =back
129
130 =item B<-b -u>
131
132 Output is buffered (DEFAULT), Output is unbuffered.
133
134 =item B<-t>
135
136 No conversion.
137
138 =item B<-i[@B]>
139
140 Specify the escape sequence for JIS X 0208.
141
142 =over
143
144 =item B<-i@>
145
146 Use ESC ( @. (JIS X 0208-1978)
147
148 =item B<-iB>
149
150 Use ESC ( B. (JIS X 0208-1983/1990 DEFAULT)
151
152 =back
153
154 =item B<-o[BJ]>
155
156 Specify the escape sequence for US-ASCII/JIS X 0201 Roman. (DEFAULT B)
157
158 =item B<-r>
159
160 {de/en}crypt ROT13/47
161
162 =item B<-h[123] --hiragana --katakana --katakana-hiragana>
163
164 =over
165
166 =item B<-h1 --hiragana>
167
168 Katakana to Hiragana conversion.
169
170 =item B<-h2 --katakana>
171
172 Hiragana to Katakana conversion.
173
174 =item B<-h3 --katakana-hiragana>
175
176 Katakana to Hiragana and Hiragana to Katakana conversion.
177
178 =back
179
180 =item B<-T>
181
182 Text mode output (MS-DOS)
183
184 =item B<-f[I<m> [- I<n>]]>
185
186 Folding on I<m> length with I<n> margin in a line.
187 Without this option, fold length is 60 and fold margin is 10.
188
189 =item B<-F>
190
191 New line preserving line folding.
192
193 =item B<-Z[0-3]>
194
195 Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
196
197 =over
198
199 =item B<-Z -Z0>
200
201 Convert X0208 alphabet to ASCII.
202
203 =item B<-Z1>
204
205 Convert X0208 kankaku to single ASCII space.
206
207 =item B<-Z2>
208
209 Convert X0208 kankaku to double ASCII spaces.
210
211 =item B<-Z3>
212
213 Replacing fullwidth >, <, ", & into '&gt;', '&lt;', '&quot;', '&amp;' as in HTML.
214
215 =back
216
217 =item B<-X -x>
218
219 With B<-X> or without this option, X0201 is converted into X0208 Kana.
220 With B<-x>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
221 In JIS output, ESC-(-I is used. In EUC output, SS2 is used.
222
223 =item B<-B[0-2]>
224
225 Assume broken JIS-Kanji input, which lost ESC.
226 Useful when your site is using old B-News Nihongo patch.
227
228 =over
229
230 =item B<-B1>
231
232 allows any chars after ESC-( or ESC-$.
233
234 =item B<-B2>
235
236 force ASCII after NL.
237
238 =back
239
240 =item B<-I>
241
242 Replacing non iso-2022-jp char into a geta character
243 (substitute character in Japanese).
244
245 =item B<-m[BQN0]>
246
247 MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
248 To see ISO8859-1 (Latin-1) -l is necessary.
249
250 =over
251
252 =item B<-mB>
253
254 Decode MIME base64 encoded stream. Remove header or other part before
255 conversion. 
256
257 =item B<-mQ>
258
259 Decode MIME quoted stream. '_' in quoted stream is converted to space.
260
261 =item B<-mN>
262
263 Non-strict decoding.
264 It allows line break in the middle of the base64 encoding.
265
266 =item B<-m0>
267
268 No MIME decode.
269
270 =back
271
272 =item B<-M>
273
274 MIME encode. Header style. All ASCII code and control characters are intact.
275
276 =over
277
278 =item B<-MB>
279
280 MIME encode Base64 stream.
281 Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.
282
283 =item B<-MQ>
284
285 Perform quoted encoding.
286
287 =back
288
289 =item B<-l>
290
291 Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
292 B<-s>, B<-e> and B<-x> are not compatible with this option.
293
294 =item B<-L[uwm] -d -c>
295
296 Convert line breaks.
297
298 =over
299
300 =item B<-Lu -d>
301
302 unix (LF)
303
304 =item B<-Lw -c>
305
306 windows (CRLF)
307
308 =item B<-Lm>
309
310 mac (CR)
311
312 Without this option, nkf doesn't convert line breaks.
313
314 =back
315
316 =item B<--fj --unix --mac --msdos --windows>
317
318 Convert for these systems.
319
320 =item B<--jis --euc --sjis --mime --base64>
321
322 Convert to named code.
323
324 =item B<--jis-input --euc-input --sjis-input --mime-input --base64-input>
325
326 Assume input system
327
328 =item B<--ic=I<input codeset> --oc=I<output codeset>>
329
330 Set the input or output codeset.
331 NKF supports following codesets and those codeset names are case insensitive.
332
333 =over
334
335 =item ISO-2022-JP
336
337 a.k.a. RFC1468, 7bit JIS, JUNET
338
339 =item EUC-JP (eucJP-nkf)
340
341 a.k.a. AT&T JIS, Japanese EUC, UJIS
342
343 =item eucJP-ascii
344
345 =item eucJP-ms
346
347 =item CP51932
348
349 Microsoft Version of EUC-JP.
350
351 =item Shift_JIS
352
353 a.k.a. SJIS, MS_Kanji
354
355 =item Windows-31J
356
357 a.k.a. CP932
358
359 =item UTF-8
360
361 same as UTF-8N
362
363 =item UTF-8N
364
365 UTF-8 without BOM
366
367 =item UTF-8-BOM
368
369 UTF-8 with BOM
370
371 =item UTF8-MAC (input only)
372
373 decomposed UTF-8
374
375 =item UTF-16
376
377 same as UTF-16BE
378
379 =item UTF-16BE
380
381 UTF-16 Big Endian without BOM
382
383 =item UTF-16BE-BOM
384
385 UTF-16 Big Endian with BOM
386
387 =item UTF-16LE
388
389 UTF-16 Little Endian without BOM
390
391 =item UTF-16LE-BOM
392
393 UTF-16 Little Endian with BOM
394
395 =item UTF-32
396
397 same as UTF-32BE
398
399 =item UTF-32BE
400
401 UTF-32 Big Endian without BOM
402
403 =item UTF-32BE-BOM
404
405 UTF-32 Big Endian with BOM
406
407 =item UTF-32LE
408
409 UTF-32 Little Endian without BOM
410
411 =item UTF-32LE-BOM
412
413 UTF-32 Little Endian with BOM
414
415 =back
416
417 =item B<--fb-{skip, html, xml, perl, java, subchar}>
418
419 Specify the way that nkf handles unassigned characters.
420 Without this option, --fb-skip is assumed.
421
422 =item B<--prefix=I<escape character>I<target character>..>
423
424 When nkf converts to Shift_JIS,
425 nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters.
426 1st byte of argument is the escape character and following bytes are target characters.
427
428 =item B<--no-cp932ext>
429
430 Handle the characters extended in CP932 as unassigned characters.
431
432 =item B<--no-best-fit-chars>
433
434 When Unicode to Encoded byte conversion,
435 don't convert characters which is not round trip safe.
436 When Unicode to Unicode conversion,
437 with this and -x option, nkf can be used as UTF converter.
438 (In other words, without this and -x option, nkf doesn't save some characters)
439
440 When nkf converts strings that related to path, you should use this opion.
441
442 =item B<--cap-input>
443
444 Decode hex encoded characters.
445
446 =item B<--url-input>
447
448 Unescape percent escaped characters.
449
450 =item B<--numchar-input>
451
452 Decode character reference, such as "&#....;".
453
454
455 =item B<--in-place[=>I<SUFFIX>B<]>  B<--overwrite[=>I<SUFFIX>B<]>
456
457 Overwrite B<original> listed files by filtered result.
458
459 B<Note> --overwrite preserves timestamps of original files.
460
461 =item B<--guess=[12]>
462
463 Print guessed encoding and newline. (2 is default, 1 is only encoding)
464
465 =item B<--help>
466
467 Print nkf's help.
468
469 =item B<--version>
470
471 Print nkf's version.
472
473
474 =item B<-->
475
476 Ignore rest of -option.
477
478 =back
479
480 =head1 AUTHOR
481
482 Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
483
484 Copyright (c) 1996-2015, The nkf Project.
485
486
487 =cut