OSDN Git Service

Move changelog from nkf manual.
[nkf/nkf.git] / NKF.mod / NKF.pm
1 ## Copyright (C) 1996,1998
2 ## Copyright (C) 2002
3 ## Ï¢ÍíÀ衧 Î°µåÂç³Ø¾ðÊ󹩳زʠ²ÏÌî ¿¿¼£  mime/X0208 support
4 ## ¡ÊE-Mail Address: kono@ie.u-ryukyu.ac.jp¡Ë
5 ## Ï¢ÍíÀ衧 COW for DOS & Win16 & Win32 & OS/2
6 ## ¡ÊE-Mail Address: GHG00637@niftyserve.or.p¡Ë
7 ##    
8 ##    ¤³¤Î¥½¡¼¥¹¤Î¤¤¤«¤Ê¤ëÊ£¼Ì¡¤²þÊÑ¡¤½¤Àµ¤âµöÂú¤·¤Þ¤¹¡£¤¿¤À¤·¡¢
9 ##    ¤½¤ÎºÝ¤Ë¤Ï¡¢Ã¯¤¬¹×¸¥¤·¤¿¤ò¼¨¤¹¤³¤ÎÉôʬ¤ò»Ä¤¹¤³¤È¡£
10 ##    ºÆÇÛÉۤ仨»ï¤ÎÉÕÏ¿¤Ê¤É¤ÎÌ䤤¹ç¤ï¤»¤âɬÍפ¢¤ê¤Þ¤»¤ó¡£
11 ##    ±ÄÍøÍøÍѤâ¾åµ­¤ËÈ¿¤·¤Ê¤¤ÈϰϤǵö²Ä¤·¤Þ¤¹¡£
12 ##    ¥Ð¥¤¥Ê¥ê¤ÎÇÛÉۤκݤˤÏversion message¤òÊݸ¤¹¤ë¤³¤È¤ò¾ò·ï¤È¤·¤Þ¤¹¡£
13 ##    ¤³¤Î¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ¤ÏÆä˲¿¤ÎÊݾڤ⤷¤Ê¤¤¡¢°­¤·¤«¤é¤º¡£
14 ##    
15 ##    Everyone is permitted to do anything on this program
16 ##    including copying, modifying, improving, 
17 ##    as long as you don't try to pretend that you wrote it.
18 ##    i.e., the above copyright notice has to appear in all copies.  
19 ##    Binar y distribution requires original version messages.
20 ##    You don't have to ask before copying, redistribution or publishing.
21 ##    THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
22
23
24 package NKF;
25
26 use strict;
27 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
28
29 require Exporter;
30 require DynaLoader;
31
32 @ISA = qw(Exporter DynaLoader);
33 # Items to export into callers namespace by default. Note: do not export
34 # names by default without a very good reason. Use EXPORT_OK instead.
35 # Do not simply export all your public functions/methods/constants.
36 @EXPORT = qw(
37         nkf     nkf_continue    inputcode
38 );
39 $VERSION = '2.06';
40
41 bootstrap NKF $VERSION;
42
43 # Preloaded methods go here.
44
45 # Autoload methods go after =cut, and are processed by the autosplit program.
46
47 1;
48 __END__
49 # Below is the stub of documentation for your module. You better edit it!
50
51 =head1 NAME
52
53 NKF - Perl extension for Network Kanji Filter
54
55 =head1 SYNOPSIS
56
57   use NKF;
58   $output = nkf("-s",$input);
59
60 =head1 DESCRIPTION
61
62 This is a Perl Extension version of nkf (Netowrk Kanji Filter).
63 It converts the last argument and return converted result. Conversion
64 details are specified by flags before the last argument.
65
66 B<Nkf> is a yet another kanji code converter among networks, hosts and terminals.
67 It converts input kanji code to designated kanji code
68 such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16.
69
70 One of the most unique faculty of B<nkf> is the guess of the input kanji encodings.
71 It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 and UTF-16.
72 So users needn't set the input kanji code explicitly.
73
74 By default, X0201 kana is converted into X0208 kana.
75 For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported.
76 For automatic code detection, nkf assumes no X0201 kana in Shift_JIS.
77 To accept X0201 in Shift_JIS, use B<-X>, B<-x> or B<-S>.
78
79 =head1 Flags
80
81 =over
82
83 =item B<-b -u>
84
85 Output is buffered (DEFAULT), Output is unbuffered.
86
87 =item B<-j -s -e -w -w16>
88
89 Output code is ISO-2022-JP (7bit JIS), Shift_JIS, EUC-JP,
90 UTF-8N, UTF-16BE.
91 Without this option and compile option, ISO-2022-JP is assumed.
92
93 =item B<-J -S -E -W -W16>
94
95 Input assumption is JIS 7 bit, Shift_JIS, EUC-JP,
96 UTF-8, UTF-16LE.
97
98 =over
99
100 =item B<-J>
101
102 Assume  JIS input. It also accepts EUC-JP.
103 This is the default. This flag does not exclude Shift_JIS.
104
105 =item B<-S>
106
107 Assume Shift_JIS and X0201 kana input. It also accepts JIS.
108 EUC-JP is recognized as X0201 kana. Without B<-x> flag,
109 X0201 kana (halfwidth kana) is converted into X0208.
110
111 =item B<-E>
112
113 Assume EUC-JP input. It also accepts JIS.
114 Same as -J.
115
116 =back
117
118 =item B<-t>
119
120 No conversion.
121
122 =item B<-i[@B]>
123
124 Specify the Esc Seq for JIS X 0208-1978/83. (DEFAULT B)
125
126 =item B<-o[BJH]>
127
128 Specify the Esc Seq for ASCII/Roman. (DEFAULT B)
129
130 =item B<-r>
131
132 {de/en}crypt ROT13/47
133
134 =item B<-h[123] --hiragana --katakana --katakana-hiragana>
135
136 =over
137
138 =item B<-h1 --hiragana>
139
140 Katakana to Hiragana conversion.
141
142 =item B<-h2 --katakana>
143
144 Hiragana to Katakana conversion.
145
146 =item B<-h3 --katakana-hiragana>
147
148 Katakana to Hiragana and Hiragana to Katakana conversion.
149
150 =back
151
152 =item B<-T>
153
154 Text mode output (MS-DOS)
155
156 =item B<-l>
157
158 ISO8859-1 (Latin-1) support
159
160 =item B<-f[I<m> [- I<n>]]>
161
162 Folding on I<m> length with I<n> margin in a line.
163 Without this option, fold length is 60 and fold margin is 10.
164
165 =item B<-F>
166
167 New line preserving line folding.
168
169 =item B<-Z[0-3]>
170
171 Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
172
173 =over
174
175 =item B<-Z -Z0>
176
177 Convert X0208 alphabet to ASCII.
178
179 =item B<-Z1>
180
181 Converts X0208 kankaku to single ASCII space.
182
183 =item B<-Z2>
184
185 Converts X0208 kankaku to double ASCII spaces.
186
187 =item B<-Z3>
188
189 Replacing Fullwidth >, <, ", & into '&gt;', '&lt;', '&quot;', '&amp;' as in HTML.
190
191 =back
192
193 =item B<-X -x>
194
195 Assume X0201 kana in MS-Kanji.
196 With B<-X> or without this option, X0201 is converted into X0208 Kana.
197 With B<-x>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
198 In JIS output, ESC-(-I is used. In EUC output, SSO is used.
199
200 =item B<-B[0-2]>
201
202 Assume broken JIS-Kanji input, which lost ESC.
203 Useful when your site is using old B-News Nihongo patch.
204
205 =over
206
207 =item B<-B1>
208
209 allows any char after ESC-( or ESC-$.
210
211 =item B<-B2>
212
213 forces ASCII after NL.
214
215 =back
216
217 =item B<-I>
218
219 Replacing non iso-2022-jp char into a geta character
220 (substitute character in Japanese).
221
222 =item B<-m[BQN0]>
223
224 MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
225 To see ISO8859-1 (Latin-1) -l is necessary.
226
227 =over
228
229 =item B<-mB>
230
231 Decode MIME base64 encoded stream. Remove header or other part before
232 conversion. 
233
234 =item B<-mQ>
235
236 Decode MIME quoted stream. '_' in quoted stream is converted to space.
237
238 =item B<-mN>
239
240 Non-strict decoding.
241 It allows line break in the middle of the base64 encoding.
242
243 =item B<-m0>
244
245 No MIME decode.
246
247 =back
248
249 =item B<-M>
250
251 MIME encode. Header style. All ASCII code and control characters are intact.
252
253 =over
254
255 =item B<-MB>
256
257 MIME encode Base64 stream.
258 Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.
259
260 =item B<-MQ>
261
262 Perfome quoted encoding.
263
264 =back
265
266 =item B<-l>
267
268 Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
269 B<-s>, B<-e> and B<-x> are not compatible with this option.
270
271 =item B<-L[uwm] -d -c>
272
273 Convert line breaks.
274
275 =over
276
277 =item B<-Lu -d>
278
279 unix (LF)
280
281 =item B<-Lw -c>
282
283 windows (CRLF)
284
285 =item B<-Lm>
286
287 mac (CR)
288
289 Without this option, nkf doesn't convert line breaks.
290
291 =back
292
293 =item B<--fj --unix --mac --msdos --windows>
294
295 convert for these system
296
297 =item B<--jis --euc --sjis --mime --base64>
298
299 convert for named code
300
301 =item B<--jis-input --euc-input --sjis-input --mime-input --base64-input>
302
303 assume input system
304
305 =item B<--ic=I<input codeset> --oc=I<output codeset>>
306
307 Set the input or output codeset.
308 NKF supports following codesets and those codeset name are case insensitive.
309
310 =over
311
312 =item ISO-2022-JP
313
314 a.k.a. RFC1468, 7bit JIS, JUNET
315
316 =item EUC-JP (eucJP-nkf)
317
318 a.k.a. AT&T JIS, Japanese EUC, UJIS
319
320 =item eucJP-ascii
321
322 =item eucJP-ms
323
324 =item CP51932
325
326 Microsoft Version of EUC-JP.
327
328 =item Shift_JIS
329
330 a.k.a. SJIS, MS-Kanji
331
332 =item CP932
333
334 a.k.a. Windows-31J
335
336 =item UTF-8
337
338 same as UTF-8N
339
340 =item UTF-8N
341
342 UTF-8 without BOM
343
344 =item UTF-8-BOM
345
346 UTF-8 with BOM
347
348 =item UTF-16
349
350 same as UTF-16BE
351
352 =item UTF-16BE
353
354 UTF-16 Big Endian without BOM
355
356 =item UTF-16BE-BOM
357
358 UTF-16 Big Endian with BOM
359
360 =item UTF-16LE
361
362 UTF-16 Little Endian without BOM
363
364 =item UTF-16LE-BOM
365
366 UTF-16 Little Endian with BOM
367
368 =item UTF8-MAC (input only)
369
370 =back
371
372 =item B<--fb-{skip, html, xml, perl, java, subchar}>
373
374 Specify the way that nkf handles unassigned characters.
375 Without this option, --fb-skip is assumed.
376
377 =item B<--prefix=I<escape character>I<target character>..>
378
379 When nkf converts to Shift_JIS,
380 nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters.
381 1st byte of argument is the escape character and following bytes are target characters.
382
383 =item B<--no-cp932ext>
384
385 Handle the characters extended in CP932 as unassigned characters.
386
387 =item B<--no-best-fit-chars>
388
389 When Unicode to Encoded byte conversion,
390 don't convert characters which is not round trip safe.
391 When Unicode to Unicode conversion,
392 with this and -x option, nkf can be used as UTF converter.
393 (In other words, without this and -x option, nkf doesn't save some characters)
394
395 When nkf convert string which related to path, you should use this opion.
396
397 =item B<--cap-input>
398
399 Decode hex encoded characters.
400
401 =item B<--url-input>
402
403 Unescape percent escaped characters.
404
405 =item B<--numchar-input>
406
407 Decode character reference, such as "&#....;".
408
409 =item B<-->
410
411 Ignore rest of -option.
412
413 =back
414
415 =head1 AUTHOR
416
417 Network Kanji Filter Version 2.0.6
418
419 Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW
420                      2002-2006 Kono, Furukawa, Naruse, mastodon
421
422 =head1 SEE ALSO
423
424 perl(1).   nkf(1)
425
426 =cut