Kanji Converter for Ruby.
- G
- I
- K
- T
| AUTO | = | NKF::AUTO |
Auto-Detect |
||
| JIS | = | NKF::JIS |
ISO-2022-JP |
||
| EUC | = | NKF::EUC |
EUC-JP |
||
| SJIS | = | NKF::SJIS |
Shift_JIS |
||
| BINARY | = | NKF::BINARY |
| NOCONV | = | NKF::NOCONV |
| ASCII | = | NKF::ASCII |
| UTF8 | = | NKF::UTF8 |
UTF-8 |
||
| UTF16 | = | NKF::UTF16 |
UTF-16 |
||
| UTF32 | = | NKF::UTF32 |
UTF-32 |
||
| UNKNOWN | = | NKF::UNKNOWN |
Returns whether input encoding is EUC-JP or not.
Note don't expect this return value is MatchData.
Returns whether input encoding is ISO-2022-JP or not.
# File ../ruby/ext/nkf/lib/kconv.rb, line 173 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
Returns whether input encoding is Shift_JIS or not.
Returns whether input encoding is UTF-8 or not.
Convert str to to_enc. to_enc and
from_enc are given as constants of Kconv or Encoding objects.
Convert str to EUC-JP
Convert str to ISO-2022-JP
Convert self to locale encoding
Convert str to Shift_JIS
Convert str to UTF-16
Convert str to UTF-32
Convert str to UTF-8
Returns whether input encoding is EUC-JP or not.
Note don't expect this return value is MatchData.
Returns whether input encoding is ISO-2022-JP or not.
# File ../ruby/ext/nkf/lib/kconv.rb, line 173 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
Returns whether input encoding is Shift_JIS or not.
Returns whether input encoding is UTF-8 or not.
Convert str to to_enc. to_enc and
from_enc are given as constants of Kconv or Encoding objects.
Convert str to EUC-JP
Convert str to ISO-2022-JP
Convert self to locale encoding
Convert str to Shift_JIS
Convert str to UTF-16
Convert str to UTF-32