Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Python Japanese codecs by NKF
C Python Other
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
mailman
nkf-dist
.gitignore
CHANGES
MANIFEST.in
Makefile
README.md
nkf.c
nkf_codecs.py
setup.cfg
setup.py

README.md

Python Interface to NKF

How to Install

Install from PyPI:

$ sudo pip install nkf

Install from source tree:

$ make
$ sudo make install

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')

## Guess character encoding
input_encoding = nkf.guess('some string')

guess() function guesses an input string encoding and returns one of next strings:

  • BINARY
  • ASCII
  • Shift_JIS
  • CP932
  • EUC-JP
  • EUCJP-MS
  • CP51932
  • ISO-2022-JP
  • CP50221
  • CP50220
  • UTF-8
  • UTF-16
  • UTF-32
Something went wrong with that request. Please try again.