Module

Kconv

Inheritance

Kanji Converter for Ruby.

Constants

Name   Description
ASCII = NKF::ASCII ASCII
AUTO = NKF::AUTO Auto-Detect
BINARY = NKF::BINARY BINARY
EUC = NKF::EUC EUC-JP
JIS = NKF::JIS ISO-2022-JP
NOCONV = NKF::NOCONV NOCONV
REVISION = %q$Revision: 11708 $ Revision of kconv.rb
RegexpEucjp = /\A(?: [\x00-\x7f] | \x8e [\xa1-\xdf] | \x8f [\xa1-\xfe] [\xa1-\xfe] | [\xa1-\xfe] [\xa1-\xfe] )*\z/nx Regexp of EUC-JP string (private constant)
RegexpShiftjis = /\A(?: [\x00-\x7f\xa1-\xdf] | [\x81-\x9f\xe0-\xfc][\x40-\x7e\x80-\xfc] )*\z/nx Regexp of Shift_JIS string (private constant)
RegexpUtf8 = /\A(?: [\x00-\x7f] | [\xc2-\xdf] [\x80-\xbf] | \xe0 [\xa0-\xbf] [\x80-\xbf] | [\xe1-\xef] [\x80-\xbf] [\x80-\xbf] | \xf0 [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] | [\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf] | \xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf] )*\z/nx Regexp of UTF-8 string (private constant)
SJIS = NKF::SJIS Shift_JIS
UNKNOWN = NKF::UNKNOWN UNKNOWN
UTF16 = NKF::UTF16 UTF-16
UTF32 = NKF::UTF32 UTF-32
UTF8 = NKF::UTF8 UTF-8

Methods

Instance

Visibility Signature
public guess (str)
public guess_old (str)
public iseuc (str)
public issjis (str)
public isutf8 (str)
public kconv (str, out_code, in_code = AUTO)
public toeuc (str)
public tojis (str)
public tosjis (str)
public toutf16 (str)
public toutf8 (str)

Instance Method Detail

Kconv.guess(str) → integer

Guess input encoding by NKF.guess2

Kconv.guess_old(str) → integer

Guess input encoding by NKF.guess1

Kconv.iseuc(str) → obj or nil

Returns whether input encoding is EUC-JP or not.

Note don‘t expect this return value is MatchData.

Kconv.issjis(str) → obj or nil

Returns whether input encoding is Shift_JIS or not.

Note don‘t expect this return value is MatchData.

Kconv.isutf8(str) → obj or nil

Returns whether input encoding is UTF-8 or not.

Note don‘t expect this return value is MatchData.

Kconv.kconv(str, out_code, in_code = Kconv::AUTO)

Convert str to out_code. out_code and in_code are given as constants of Kconv.

Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don‘t want to decode them, use NKF.nkf.

Kconv.toeuc(str) → string

Convert str to EUC-JP

Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don‘t want it, use NKF.nkf(’-exm0’, str).

Kconv.tojis(str) → string

Convert str to ISO-2022-JP

Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don‘t want it, use NKF.nkf(’-jxm0’, str).

Kconv.tosjis(str) → string

Convert str to Shift_JIS

Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don‘t want it, use NKF.nkf(’-sxm0’, str).

Kconv.toutf16(str) → string

Convert str to UTF-16

Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don‘t want it, use NKF.nkf(’-w16xm0’, str).

Kconv.toutf8(str) → string

Convert str to UTF-8

Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don‘t want it, use NKF.nkf(’-wxm0’, str).