1 ## Copyright (C) 1996,1998
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¡Ë
8 ## ¤³¤Î¥½¡¼¥¹¤Î¤¤¤«¤Ê¤ëÊ£¼Ì¡¤²þÊÑ¡¤½¤Àµ¤âµöÂú¤·¤Þ¤¹¡£¤¿¤À¤·¡¢
9 ## ¤½¤ÎºÝ¤Ë¤Ï¡¢Ã¯¤¬¹×¸¥¤·¤¿¤ò¼¨¤¹¤³¤ÎÉôʬ¤ò»Ä¤¹¤³¤È¡£
10 ## ºÆÇÛÉۤ仨»ï¤ÎÉÕÏ¿¤Ê¤É¤ÎÌ䤤¹ç¤ï¤»¤âɬÍפ¢¤ê¤Þ¤»¤ó¡£
11 ## ±ÄÍøÍøÍѤâ¾åµ¤ËÈ¿¤·¤Ê¤¤ÈϰϤǵö²Ä¤·¤Þ¤¹¡£
12 ## ¥Ð¥¤¥Ê¥ê¤ÎÇÛÉۤκݤˤÏversion message¤òÊݸ¤¹¤ë¤³¤È¤ò¾ò·ï¤È¤·¤Þ¤¹¡£
13 ## ¤³¤Î¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ¤ÏÆÃ¤Ë²¿¤ÎÊݾڤ⤷¤Ê¤¤¡¢°¤·¤«¤é¤º¡£
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.
27 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
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.
37 nkf nkf_continue inputcode
41 bootstrap NKF $VERSION;
43 # Preloaded methods go here.
45 # Autoload methods go after =cut, and are processed by the autosplit program.
51 # =begin ¤«¤é =begin COMMAND ¤Þ¤Ç¤Ï Perl/NKF ¤Î¥É¥¥å¥á¥ó¥È
52 # =begin COMMAND ¤«¤é =end ¤Þ¤Ç¤Ï nkf ¥³¥Þ¥ó¥É¤Î¥É¥¥å¥á¥ó¥È
59 NKF - Perl extension for Network Kanji Filter
63 nkf - Network Kanji Filter
72 $output = nkf("-s",$input);
76 nkf B<[-butjnesliohrTVvwWJESZxXFfmMBOcdILg]> B<[>I<file ...>B<]>
84 This is a Perl Extension version of nkf (Netowrk Kanji Filter).
85 It converts the last argument and return converted result. Conversion
86 details are specified by flags before the last argument.
90 B<Nkf> is a yet another kanji code converter among networks, hosts and terminals.
91 It converts input kanji code to designated kanji code
92 such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16.
94 One of the most unique faculty of B<nkf> is the guess of the input kanji encodings.
95 It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 and UTF-16.
96 So users needn't set the input kanji code explicitly.
98 By default, X0201 kana is converted into X0208 kana.
99 For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported.
100 For automatic code detection, nkf assumes no X0201 kana in Shift_JIS.
101 To accept X0201 in Shift_JIS, use B<-X>, B<-x> or B<-S>.
109 Output is buffered (DEFAULT), Output is unbuffered.
111 =item B<-j -s -e -w -w16>
113 Output code is ISO-2022-JP (7bit JIS), Shift_JIS, EUC-JP,
115 Without this option and compile option, ISO-2022-JP is assumed.
117 =item B<-J -S -E -W -W16>
119 Input assumption is JIS 7 bit, Shift_JIS, EUC-JP,
131 Assume Shift_JIS and X0201 kana input.
132 EUC-JP is recognized as X0201 kana. Without B<-x> flag,
133 X0201 kana (halfwidth kana) is converted into X0208.
147 Specify the Esc Seq for JIS X 0208-1978/83. (DEFAULT B)
151 Specify the Esc Seq for ASCII/Roman. (DEFAULT B)
155 {de/en}crypt ROT13/47
157 =item B<-h[123] --hiragana --katakana --katakana-hiragana>
161 =item B<-h1 --hiragana>
163 Katakana to Hiragana conversion.
165 =item B<-h2 --katakana>
167 Hiragana to Katakana conversion.
169 =item B<-h3 --katakana-hiragana>
171 Katakana to Hiragana and Hiragana to Katakana conversion.
177 Text mode output (MS-DOS)
181 ISO8859-1 (Latin-1) support
183 =item B<-f[I<m> [- I<n>]]>
185 Folding on I<m> length with I<n> margin in a line.
186 Without this option, fold length is 60 and fold margin is 10.
190 New line preserving line folding.
194 Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
200 Convert X0208 alphabet to ASCII.
204 Convert X0208 kankaku to single ASCII space.
208 Convert X0208 kankaku to double ASCII spaces.
212 Replacing fullwidth >, <, ", & into '>', '<', '"', '&' as in HTML.
218 Assume X0201 kana in MS-Kanji.
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, SSO is used.
225 Assume broken JIS-Kanji input, which lost ESC.
226 Useful when your site is using old B-News Nihongo patch.
232 allows any chars after ESC-( or ESC-$.
236 force ASCII after NL.
242 Replacing non iso-2022-jp char into a geta character
243 (substitute character in Japanese).
247 MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
248 To see ISO8859-1 (Latin-1) -l is necessary.
254 Decode MIME base64 encoded stream. Remove header or other part before
259 Decode MIME quoted stream. '_' in quoted stream is converted to space.
264 It allows line break in the middle of the base64 encoding.
274 MIME encode. Header style. All ASCII code and control characters are intact.
280 MIME encode Base64 stream.
281 Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.
285 Perform quoted encoding.
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.
294 =item B<-L[uwm] -d -c>
312 Without this option, nkf doesn't convert line breaks.
316 =item B<--fj --unix --mac --msdos --windows>
318 Convert for these systems.
320 =item B<--jis --euc --sjis --mime --base64>
322 Convert to named code.
324 =item B<--jis-input --euc-input --sjis-input --mime-input --base64-input>
328 =item B<--ic=I<input codeset> --oc=I<output codeset>>
330 Set the input or output codeset.
331 NKF supports following codesets and those codeset names are case insensitive.
337 a.k.a. RFC1468, 7bit JIS, JUNET
339 =item EUC-JP (eucJP-nkf)
341 a.k.a. AT&T JIS, Japanese EUC, UJIS
349 Microsoft Version of EUC-JP.
353 a.k.a. SJIS, MS-Kanji
371 =item UTF8-MAC (input only)
381 UTF-16 Big Endian without BOM
385 UTF-16 Big Endian with BOM
389 UTF-16 Little Endian without BOM
393 UTF-16 Little Endian with BOM
397 =item B<--fb-{skip, html, xml, perl, java, subchar}>
399 Specify the way that nkf handles unassigned characters.
400 Without this option, --fb-skip is assumed.
402 =item B<--prefix=I<escape character>I<target character>..>
404 When nkf converts to Shift_JIS,
405 nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters.
406 1st byte of argument is the escape character and following bytes are target characters.
408 =item B<--no-cp932ext>
410 Handle the characters extended in CP932 as unassigned characters.
412 =item B<--no-best-fit-chars>
414 When Unicode to Encoded byte conversion,
415 don't convert characters which is not round trip safe.
416 When Unicode to Unicode conversion,
417 with this and -x option, nkf can be used as UTF converter.
418 (In other words, without this and -x option, nkf doesn't save some characters)
420 When nkf converts strings that related to path, you should use this opion.
424 Decode hex encoded characters.
428 Unescape percent escaped characters.
430 =item B<--numchar-input>
432 Decode character reference, such as "&#....;".
436 =item B<--in-place[=>I<SUFFIX>B<]> B<--overwrite[=>I<SUFFIX>B<]>
438 Overwrite B<original> listed files by filtered result.
440 B<Note> --overwrite preserves timestamps of original files.
442 =item B<--guess=[12]>
444 Print guessed encoding and newline. (2 is default, 1 is only encoding)
458 Ignore rest of -option.
464 Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),
466 Copyright (C) 2000 S. Kono, COW.
468 Copyright (C) 2002-2009 Kono, Furukawa, Naruse, mastodon.
470 The nkf Project https://sourceforge.jp/projects/nkf