Kanji Converter for Ruby.
Methods
- G
- I
- K
- T
Constants
ASCII | = | NKF::ASCII |
AUTO | = | NKF::AUTO |
Auto-Detect |
||
BINARY | = | NKF::BINARY |
EUC | = | NKF::EUC |
EUC-JP |
||
JIS | = | NKF::JIS |
ISO-2022-JP |
||
NOCONV | = | NKF::NOCONV |
SJIS | = | NKF::SJIS |
Shift_JIS |
||
UNKNOWN | = | NKF::UNKNOWN |
UTF16 | = | NKF::UTF16 |
UTF-16 |
||
UTF32 | = | NKF::UTF32 |
UTF-32 |
||
UTF8 | = | NKF::UTF8 |
UTF-8 |
Class Public methods
Kconv.iseuc(str) => true or false Link
Returns whether input encoding is EUC-JP or not.
Note don’t expect this return value is MatchData
.
Kconv.isjis(str) => true or false Link
Returns whether input encoding is ISO-2022-JP or not.
# File ruby/ext/nkf/lib/kconv.rb, line 174 def isjis(str) /\A [\t\n\r\x20-\x7E]* (?: (?:\x1b \x28 I [\x21-\x7E]* |\x1b \x28 J [\x21-\x7E]* |\x1b \x24 @ (?:[\x21-\x7E]{2})* |\x1b \x24 B (?:[\x21-\x7E]{2})* |\x1b \x24 \x28 D (?:[\x21-\x7E]{2})* )* \x1b \x28 B [\t\n\r\x20-\x7E]* )* \z/nox =~ str.dup.force_encoding('BINARY') ? true : false end
Kconv.issjis(str) => true or false Link
Returns whether input encoding is Shift_JIS or not.
Kconv.isutf8(str) => true or false Link
Returns whether input encoding is UTF-8 or not.
Kconv.kconv(str, to_enc, from_enc=nil) Link
Kconv.toeuc(str) => string Link
Convert str
to EUC-JP
Kconv.tojis(str) => string Link
Convert str
to ISO-2022-JP
Kconv.tolocale => string Link
Convert self
to locale encoding
Kconv.tosjis(str) => string Link
Convert str
to Shift_JIS
Kconv.toutf16(str) => string Link
Convert str
to UTF-16
Kconv.toutf32(str) => string Link
Convert str
to UTF-32