mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Mon Jun 19 23:40:59 2006 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/lib/kconv.rb: remove default -m0 and fix document.
* ext/nkf/nkf-8/{nkf.c, config.h, utf8tbl.c, utf8tbl.h}:
imported nkf 2.0.7.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
23f1f6b62d
commit
f36b7d8fd5
5 changed files with 743 additions and 792 deletions
|
|
@ -1,3 +1,10 @@
|
||||||
|
Mon Jun 19 23:40:59 2006 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/nkf/lib/kconv.rb: remove default -m0 and fix document.
|
||||||
|
|
||||||
|
* ext/nkf/nkf-8/{nkf.c, config.h, utf8tbl.c, utf8tbl.h}:
|
||||||
|
imported nkf 2.0.7.
|
||||||
|
|
||||||
Mon Jun 19 22:31:59 2006 Kouhei Sutou <kou@cozmixng.org>
|
Mon Jun 19 22:31:59 2006 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rss/rss.rb:
|
* lib/rss/rss.rb:
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,17 @@
|
||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
# ----
|
||||||
|
#
|
||||||
|
# kconv.rb implements the Kconv class for Kanji Converter. Additionally,
|
||||||
|
# some methods in String classes are added to allow easy conversion.
|
||||||
|
#
|
||||||
|
|
||||||
require 'nkf'
|
require 'nkf'
|
||||||
|
|
||||||
|
#
|
||||||
|
# Kanji Converter for Ruby.
|
||||||
|
#
|
||||||
module Kconv
|
module Kconv
|
||||||
#
|
#
|
||||||
# Public Constants
|
# Public Constants
|
||||||
|
|
@ -35,7 +43,7 @@ module Kconv
|
||||||
UTF32 = NKF::UTF32
|
UTF32 = NKF::UTF32
|
||||||
# UNKNOWN
|
# UNKNOWN
|
||||||
UNKNOWN = NKF::UNKNOWN
|
UNKNOWN = NKF::UNKNOWN
|
||||||
|
|
||||||
#
|
#
|
||||||
# Private Constants
|
# Private Constants
|
||||||
#
|
#
|
||||||
|
|
@ -130,10 +138,11 @@ module Kconv
|
||||||
# Convert <code>str</code> to ISO-2022-JP
|
# Convert <code>str</code> to ISO-2022-JP
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-jxm0', str).
|
# If you don't want it, use NKF.nkf('-jxm0', str).
|
||||||
def tojis(str)
|
def tojis(str)
|
||||||
::NKF::nkf('-jm0', str)
|
::NKF::nkf('-jm', str)
|
||||||
end
|
end
|
||||||
module_function :tojis
|
module_function :tojis
|
||||||
|
|
||||||
|
|
@ -143,7 +152,8 @@ module Kconv
|
||||||
# Convert <code>str</code> to EUC-JP
|
# Convert <code>str</code> to EUC-JP
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-exm0', str).
|
# If you don't want it, use NKF.nkf('-exm0', str).
|
||||||
def toeuc(str)
|
def toeuc(str)
|
||||||
::NKF::nkf('-em0', str)
|
::NKF::nkf('-em0', str)
|
||||||
|
|
@ -156,10 +166,11 @@ module Kconv
|
||||||
# Convert <code>str</code> to Shift_JIS
|
# Convert <code>str</code> to Shift_JIS
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-sxm0', str).
|
# If you don't want it, use NKF.nkf('-sxm0', str).
|
||||||
def tosjis(str)
|
def tosjis(str)
|
||||||
::NKF::nkf('-sm0', str)
|
::NKF::nkf('-sm', str)
|
||||||
end
|
end
|
||||||
module_function :tosjis
|
module_function :tosjis
|
||||||
|
|
||||||
|
|
@ -169,10 +180,11 @@ module Kconv
|
||||||
# Convert <code>str</code> to UTF-8
|
# Convert <code>str</code> to UTF-8
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-wxm0', str).
|
# If you don't want it, use NKF.nkf('-wxm0', str).
|
||||||
def toutf8(str)
|
def toutf8(str)
|
||||||
::NKF::nkf('-wm0', str)
|
::NKF::nkf('-wm', str)
|
||||||
end
|
end
|
||||||
module_function :toutf8
|
module_function :toutf8
|
||||||
|
|
||||||
|
|
@ -182,10 +194,11 @@ module Kconv
|
||||||
# Convert <code>str</code> to UTF-16
|
# Convert <code>str</code> to UTF-16
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-w16xm0', str).
|
# If you don't want it, use NKF.nkf('-w16xm0', str).
|
||||||
def toutf16(str)
|
def toutf16(str)
|
||||||
::NKF::nkf('-w16m0', str)
|
::NKF::nkf('-w16m', str)
|
||||||
end
|
end
|
||||||
module_function :toutf16
|
module_function :toutf16
|
||||||
|
|
||||||
|
|
@ -258,7 +271,8 @@ class String
|
||||||
# <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
|
# <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want to decode them, use NKF.nkf.
|
# If you don't want to decode them, use NKF.nkf.
|
||||||
def kconv(out_code, in_code=Kconv::AUTO)
|
def kconv(out_code, in_code=Kconv::AUTO)
|
||||||
Kconv::kconv(self, out_code, in_code)
|
Kconv::kconv(self, out_code, in_code)
|
||||||
|
|
@ -274,7 +288,8 @@ class String
|
||||||
# Convert <code>self</code> to ISO-2022-JP
|
# Convert <code>self</code> to ISO-2022-JP
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-jxm0', str).
|
# If you don't want it, use NKF.nkf('-jxm0', str).
|
||||||
def tojis; Kconv.tojis(self) end
|
def tojis; Kconv.tojis(self) end
|
||||||
|
|
||||||
|
|
@ -284,7 +299,8 @@ class String
|
||||||
# Convert <code>self</code> to EUC-JP
|
# Convert <code>self</code> to EUC-JP
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-exm0', str).
|
# If you don't want it, use NKF.nkf('-exm0', str).
|
||||||
def toeuc; Kconv.toeuc(self) end
|
def toeuc; Kconv.toeuc(self) end
|
||||||
|
|
||||||
|
|
@ -294,7 +310,8 @@ class String
|
||||||
# Convert <code>self</code> to Shift_JIS
|
# Convert <code>self</code> to Shift_JIS
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-sxm0', str).
|
# If you don't want it, use NKF.nkf('-sxm0', str).
|
||||||
def tosjis; Kconv.tosjis(self) end
|
def tosjis; Kconv.tosjis(self) end
|
||||||
|
|
||||||
|
|
@ -304,7 +321,8 @@ class String
|
||||||
# Convert <code>self</code> to UTF-8
|
# Convert <code>self</code> to UTF-8
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-wxm0', str).
|
# If you don't want it, use NKF.nkf('-wxm0', str).
|
||||||
def toutf8; Kconv.toutf8(self) end
|
def toutf8; Kconv.toutf8(self) end
|
||||||
|
|
||||||
|
|
@ -314,7 +332,8 @@ class String
|
||||||
# Convert <code>self</code> to UTF-16
|
# Convert <code>self</code> to UTF-16
|
||||||
#
|
#
|
||||||
# *Note*
|
# *Note*
|
||||||
# This method convert halfwidth katakana to fullwidth katakana.
|
# This method decode MIME encoded string and
|
||||||
|
# convert halfwidth katakana to fullwidth katakana.
|
||||||
# If you don't want it, use NKF.nkf('-w16xm0', str).
|
# If you don't want it, use NKF.nkf('-w16xm0', str).
|
||||||
def toutf16; Kconv.toutf16(self) end
|
def toutf16; Kconv.toutf16(self) end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,15 @@
|
||||||
*/
|
*/
|
||||||
/* #define INT_IS_SHORT */
|
/* #define INT_IS_SHORT */
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(INT_IS_SHORT)
|
||||||
|
typedef long nkf_char;
|
||||||
|
typedef unsigned char nkf_nfchar;
|
||||||
|
#else
|
||||||
|
typedef int nkf_char;
|
||||||
|
typedef int nkf_nfchar;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Unicode Normalization */
|
/* Unicode Normalization */
|
||||||
#define UNICODE_NORMALIZATION
|
#define UNICODE_NORMALIZATION
|
||||||
|
|
||||||
|
|
@ -71,8 +80,8 @@
|
||||||
#define NORMALIZATION_TABLE_NFC_LENGTH 3
|
#define NORMALIZATION_TABLE_NFC_LENGTH 3
|
||||||
#define NORMALIZATION_TABLE_NFD_LENGTH 9
|
#define NORMALIZATION_TABLE_NFD_LENGTH 9
|
||||||
struct normalization_pair{
|
struct normalization_pair{
|
||||||
const int nfc[NORMALIZATION_TABLE_NFC_LENGTH];
|
const nkf_nfchar nfc[NORMALIZATION_TABLE_NFC_LENGTH];
|
||||||
const int nfd[NORMALIZATION_TABLE_NFD_LENGTH];
|
const nkf_nfchar nfd[NORMALIZATION_TABLE_NFD_LENGTH];
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -8498,4 +8498,3 @@ const unsigned short *const x0212_shiftjis[] = {
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
};
|
};
|
||||||
#endif /* X0212_ENABLE */
|
#endif /* X0212_ENABLE */
|
||||||
;
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue