File: README

package info (click to toggle)
nkf 1%3A2.1.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,496 kB
  • sloc: ansic: 22,612; perl: 548; makefile: 87; sh: 19; python: 9
file content (44 lines) | stat: -rw-r--r-- 900 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Python Interface to NKF2 (2009.06.02)

1. How to Install

    1) Download latest nkf-2.0.9+ from https://osdn.jp/projects/nkf/

    2) $ tar zxvf nkf-2.x.x.tar.gz

    3) $ cd nkf-2.x.x

    4) $ tar zxvf NKF_python.tgz

    5) $ cd NKF.python

    6) # python setup.py install

2. Usage

    ## flag is same as the flags of nkf itself
    import nkf
    output = nkf.nkf(flag, input)

    ## For example, to convert from euc-jp to utf-8
    output = nkf.nkf('-Ew', 'some euc-jp string')

3.  guess() function,
    which guesses input_string_code and returns one of next strings:
        "BINARY"
        "ASCII"
        "Shift_JIS"
        "CP932"
        "EUC-JP"
        "EUCJP-MS"
        "CP51932"
        "ISO-2022-JP"
        "CP50221"
        "CP50220"
        "UTF-8"
    
    ## For example   
    import nkf
    input_code = nkf.guess('some string')

Matsumoto, Tadashi  ma2@city.plala.jp