OSDN Git Service

Change to MIT License.
[nkf/nkf.git] / NKF.mod / NKF.pm
index 386168e..c63340b 100644 (file)
@@ -36,7 +36,7 @@ require DynaLoader;
 @EXPORT = qw(
        nkf     nkf_continue    inputcode
 );
-$VERSION = '2.04';
+$VERSION = '2.08';
 
 bootstrap NKF $VERSION;
 
@@ -46,89 +46,435 @@ bootstrap NKF $VERSION;
 
 1;
 __END__
-# Below is the stub of documentation for your module. You better edit it!
+
+#
+# =begin ¤«¤é =begin COMMAND ¤Þ¤Ç¤Ï Perl/NKF ¤Î¥É¥­¥å¥á¥ó¥È
+# =begin COMMAND ¤«¤é =end ¤Þ¤Ç¤Ï nkf ¥³¥Þ¥ó¥É¤Î¥É¥­¥å¥á¥ó¥È
+# 
 
 =head1 NAME
 
-NKF - Perl extension for Network Kanji Filter 
+=begin
+
+NKF - Perl extension for Network Kanji Filter
+
+=begin COMMAND
+
+nkf - Network Kanji Filter
+
+=end
 
 =head1 SYNOPSIS
 
+=begin
+
   use NKF;
   $output = nkf("-s",$input);
 
+=begin COMMAND
+
+nkf B<[-butjnesliohrTVvwWJESZxXFfmMBOcdILg]> B<[>I<file ...>B<]>
+
+=end
+
 =head1 DESCRIPTION
 
-This is a Perl Extension version of nkf (Netowrk Kanji Filter ) 1.7.
+=begin
+
+This is a Perl Extension version of nkf (Netowrk Kanji Filter).
 It converts the last argument and return converted result. Conversion
 details are specified by flags before the last argument.
 
-Flags:
+=end
+
+B<Nkf> is a yet another kanji code converter among networks, hosts and terminals.
+It converts input kanji code to designated kanji code
+such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16.
+
+One of the most unique faculty of B<nkf> is the guess of the input kanji encodings.
+It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 and UTF-16.
+So users needn't set the input kanji code explicitly.
+
+By default, X0201 kana is converted into X0208 kana.
+For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported.
+For automatic code detection, nkf assumes no X0201 kana in Shift_JIS.
+To accept X0201 in Shift_JIS, use B<-X>, B<-x> or B<-S>.
+
+=head1 OPTIONS
+
+=over
+
+=item B<-b -u>
+
+Output is buffered (DEFAULT), Output is unbuffered.
+
+=item B<-j -s -e -w -w16>
+
+Output code is ISO-2022-JP (7bit JIS), Shift_JIS, EUC-JP,
+UTF-8N, UTF-16BE.
+Without this option and compile option, ISO-2022-JP is assumed.
+
+=item B<-J -S -E -W -W16>
+
+Input assumption is JIS 7 bit, Shift_JIS, EUC-JP,
+UTF-8, UTF-16LE.
+
+=over
+
+=item B<-J>
+
+Assume  JIS input.
+This is the default.
+
+=item B<-S>
+
+Assume Shift_JIS and X0201 kana input.
+EUC-JP is recognized as X0201 kana. Without B<-x> flag,
+X0201 kana (halfwidth kana) is converted into X0208.
+
+=item B<-E>
+
+Assume EUC-JP input.
+
+=back
+
+=item B<-t>
+
+No conversion.
+
+=item B<-i[@B]>
+
+Specify the Esc Seq for JIS X 0208-1978/83. (DEFAULT B)
+
+=item B<-o[BJH]>
+
+Specify the Esc Seq for ASCII/Roman. (DEFAULT B)
+
+=item B<-r>
+
+{de/en}crypt ROT13/47
+
+=item B<-h[123] --hiragana --katakana --katakana-hiragana>
+
+=over
+
+=item B<-h1 --hiragana>
+
+Katakana to Hiragana conversion.
+
+=item B<-h2 --katakana>
+
+Hiragana to Katakana conversion.
+
+=item B<-h3 --katakana-hiragana>
+
+Katakana to Hiragana and Hiragana to Katakana conversion.
+
+=back
+
+=item B<-T>
+
+Text mode output (MS-DOS)
+
+=item B<-l>
+
+ISO8859-1 (Latin-1) support
+
+=item B<-f[I<m> [- I<n>]]>
+
+Folding on I<m> length with I<n> margin in a line.
+Without this option, fold length is 60 and fold margin is 10.
+
+=item B<-F>
+
+New line preserving line folding.
+
+=item B<-Z[0-3]>
+
+Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
+
+=over
+
+=item B<-Z -Z0>
+
+Convert X0208 alphabet to ASCII.
+
+=item B<-Z1>
+
+Convert X0208 kankaku to single ASCII space.
+
+=item B<-Z2>
+
+Convert X0208 kankaku to double ASCII spaces.
+
+=item B<-Z3>
+
+Replacing fullwidth >, <, ", & into '&gt;', '&lt;', '&quot;', '&amp;' as in HTML.
+
+=back
+
+=item B<-X -x>
+
+Assume X0201 kana in MS-Kanji.
+With B<-X> or without this option, X0201 is converted into X0208 Kana.
+With B<-x>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
+In JIS output, ESC-(-I is used. In EUC output, SSO is used.
+
+=item B<-B[0-2]>
+
+Assume broken JIS-Kanji input, which lost ESC.
+Useful when your site is using old B-News Nihongo patch.
+
+=over
+
+=item B<-B1>
+
+allows any chars after ESC-( or ESC-$.
+
+=item B<-B2>
+
+force ASCII after NL.
+
+=back
+
+=item B<-I>
+
+Replacing non iso-2022-jp char into a geta character
+(substitute character in Japanese).
 
-C<b,u      Output is bufferred (DEFAULT),Output is unbufferred>
+=item B<-m[BQN0]>
 
-C<j,s,e    Outout code is JIS 7 bit (DEFAULT), Shift JIS, AT&T JIS (EUC)>
+MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
+To see ISO8859-1 (Latin-1) -l is necessary.
 
-C<J,S,E    Input assumption is JIS 7 bit , Shift JIS, AT&T JIS (EUC)>
+=over
 
-C<t        no conversion>
+=item B<-mB>
 
-C<i_       Output sequence to designate JIS-kanji (DEFAULT B)>
+Decode MIME base64 encoded stream. Remove header or other part before
+conversion. 
 
-C<o_       Output sequence to designate ASCII (DEFAULT B)>
+=item B<-mQ>
 
-C<r        {de/en}crypt ROT13/47>
+Decode MIME quoted stream. '_' in quoted stream is converted to space.
 
-C<m[BQ]    MIME decode [B:base64 stream,Q:quoted stream]>
+=item B<-mN>
 
-C<l        ISO8859-1 (Latin-1) support>
+Non-strict decoding.
+It allows line break in the middle of the base64 encoding.
 
-C<f        Folding: C<-f60> or C<-f>>
+=item B<-m0>
 
-C<Z[0-2]   Convert X0208 alphabet to ASCII  1: Kankaku to space,2: 2 spaces>
+No MIME decode.
 
-C<X,x      Assume X0201 kana in MS-Kanji, C<-x> preserves X0201>
+=back
 
-C<B[0-2]   Broken input  0: missing ESC,1: any X on ESC-[($]-X,2: ASCII on NL>
+=item B<-M>
 
-C<d,c      Delete \r in line feed, Add \r in line feed>
+MIME encode. Header style. All ASCII code and control characters are intact.
 
+=over
 
-C<m0 No MIME decode.>
+=item B<-MB>
 
-C<M MIME encode. Header style. All ASCII code and control characters are intact.>
+MIME encode Base64 stream.
+Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.
 
-C<MB MIME encode.  Base64 stream. Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.>
+=item B<-MQ>
 
-C<l Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.>
+Perform quoted encoding.
 
-C<L[wmu] new line mode>
+=back
 
-C<    -Lu   unix (LF) >
+=item B<-l>
 
-C<    -Lw   windows (CRLF) >
+Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
+B<-s>, B<-e> and B<-x> are not compatible with this option.
 
-C<    -Lm   mac (CR) >
+=item B<-L[uwm] -d -c>
 
-C< --fj,--unix,--mac,--msdos, --windows convert for these system>
+Convert line breaks.
 
-C< --jis,--euc,--sjis,--mime,--base64  convert for named code>
+=over
 
-C< --jis-input,--euc-input,--sjis-input,--mime-input,--base64-input assume input system>
+=item B<-Lu -d>
 
-C< -- ignore rest of -option>
+unix (LF)
 
-C< --help>
+=item B<-Lw -c>
 
-C< --version>
+windows (CRLF)
+
+=item B<-Lm>
+
+mac (CR)
+
+Without this option, nkf doesn't convert line breaks.
+
+=back
+
+=item B<--fj --unix --mac --msdos --windows>
+
+Convert for these systems.
+
+=item B<--jis --euc --sjis --mime --base64>
+
+Convert to named code.
+
+=item B<--jis-input --euc-input --sjis-input --mime-input --base64-input>
+
+Assume input system
+
+=item B<--ic=I<input codeset> --oc=I<output codeset>>
+
+Set the input or output codeset.
+NKF supports following codesets and those codeset names are case insensitive.
+
+=over
+
+=item ISO-2022-JP
+
+a.k.a. RFC1468, 7bit JIS, JUNET
+
+=item EUC-JP (eucJP-nkf)
+
+a.k.a. AT&T JIS, Japanese EUC, UJIS
+
+=item eucJP-ascii
+
+=item eucJP-ms
+
+=item CP51932
+
+Microsoft Version of EUC-JP.
+
+=item Shift_JIS
+
+a.k.a. SJIS, MS-Kanji
+
+=item Windows-31J
+
+a.k.a. CP932
+
+=item UTF-8
+
+same as UTF-8N
+
+=item UTF-8N
+
+UTF-8 without BOM
+
+=item UTF-8-BOM
+
+UTF-8 with BOM
+
+=item UTF8-MAC (input only)
+
+decomposed UTF-8
+
+=item UTF-16
+
+same as UTF-16BE
+
+=item UTF-16BE
+
+UTF-16 Big Endian without BOM
+
+=item UTF-16BE-BOM
+
+UTF-16 Big Endian with BOM
+
+=item UTF-16LE
+
+UTF-16 Little Endian without BOM
+
+=item UTF-16LE-BOM
+
+UTF-16 Little Endian with BOM
+
+=back
+
+=item B<--fb-{skip, html, xml, perl, java, subchar}>
+
+Specify the way that nkf handles unassigned characters.
+Without this option, --fb-skip is assumed.
+
+=item B<--prefix=I<escape character>I<target character>..>
+
+When nkf converts to Shift_JIS,
+nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters.
+1st byte of argument is the escape character and following bytes are target characters.
+
+=item B<--no-cp932ext>
+
+Handle the characters extended in CP932 as unassigned characters.
+
+=item B<--no-best-fit-chars>
+
+When Unicode to Encoded byte conversion,
+don't convert characters which is not round trip safe.
+When Unicode to Unicode conversion,
+with this and -x option, nkf can be used as UTF converter.
+(In other words, without this and -x option, nkf doesn't save some characters)
+
+When nkf converts strings that related to path, you should use this opion.
+
+=item B<--cap-input>
+
+Decode hex encoded characters.
+
+=item B<--url-input>
+
+Unescape percent escaped characters.
+
+=item B<--numchar-input>
+
+Decode character reference, such as "&#....;".
+
+=begin COMMAND
+
+=item B<--in-place[=>I<SUFFIX>B<]>  B<--overwrite[=>I<SUFFIX>B<]>
+
+Overwrite B<original> listed files by filtered result.
+
+B<Note> --overwrite preserves timestamps of original files.
+
+=item B<--guess=[12]>
+
+Print guessed encoding and newline. (2 is default, 1 is only encoding)
+
+=item B<--help>
+
+Print nkf's help.
+
+=item B<--version>
+
+Print nkf's version.
+
+=end
+
+=item B<-->
+
+Ignore rest of -option.
+
+=back
 
 =head1 AUTHOR
 
-Network Kanji Filter Version 1.9 (2/0002/Shinji Kono) 
-Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),1998 S. Kono, COW
+Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),
+
+Copyright (C) 2000 S. Kono, COW.
+
+Copyright (C) 2002-2009 Kono, Furukawa, Naruse, mastodon.
+
+The nkf Project https://sourceforge.jp/projects/nkf
+
+=begin
 
 =head1 SEE ALSO
 
 perl(1).   nkf(1)
 
+=end
+
 =cut