OSDN Git Service

743e0613d373fd213f50c4f77b58e08e0eaa7a16
[nkf/nkf.git] / NKF.python3 / README
1 =====================================
2 Python Interface to NKF (2009.07.08)
3 =====================================
4 Required: Python3.1+, nkf-2.0.9+
5
6 1. How to Install
7
8     1) Download latest nkf-2.0.9+ from https://osdn.jp/projects/nkf/
9
10     2) $ tar zxvf nkf-2.x.x.tar.gz
11
12     3) $ cd nkf-2.x.x
13
14     4) $ tar zxvf NKF_python.tgz
15
16     5) $ cd NKF.python
17
18     6) # python setup.py install
19
20 2. Usage
21
22     ## flag is same as the flags of nkf itself
23     ## The type of input/output is bytes
24     ## The type of flag is str or bytes
25     import nkf
26     output = nkf.nkf(flag, input)
27
28     ## For example, to convert from euc-jp to utf-8
29     output = nkf.nkf('-Ew', b'some euc-jp bytes')
30
31 3.  guess() function,
32     which guesses input_string_code and returns one of next strings:
33         "BINARY"
34         "ASCII"
35         "Shift_JIS"
36         "CP932"
37         "EUC-JP"
38         "EUCJP-MS"
39         "CP51932"
40         "ISO-2022-JP"
41         "CP50221"
42         "CP50220"
43         "UTF-8"
44     
45     ## For example 
46     ## The type of return value is str
47     import nkf
48     input_code = nkf.guess(b'some bytes')
49
50 Matsumoto, Tadashi  ma2@city.plala.jp